Re: Trouble figuring out DirectCall interface
"goobamarino" <[email protected]> Wed, 01 Oct 2003 02:49:40 -0000
| Newsgroups | gmane.lisp.corman |
|---|---|
| Message-ID | <[email protected]> |
I'm getting a Memory Access Violation on the GetFunctionAddress call itself. I have no doubt that I'm doing something wrong but I have failed to see it so far. --- In [email protected], Roger Corman <roger@c...> wrote: > Are you saying that the call to GetFunctionAddress() returns an error code? Or that it crashes with a memory access violation at that point? > > The IDE makes quite a bit of use of DirectCall. > > Have you defined your callback function in the win32 package? Yes, in :Win32 Does it need to be exported as well? I thought I had tried that already. > > Also, once you get the function pointer back successfully, the defun-direct-callback macro will assume the function is :c linkage by default, you need to use :pascal linkage if you are going to declare it as __stdcall. This would probably cause an access violation. I understand the defun-direct-callback to be for pascal linkage and the defun-direct-c-callback for C linkage, correct? calling convention ------------------ pascal = __stdcall C = __cdecl Right? quizzically, Wayne Rogers > > > At 04:56 PM 9/30/2003, you wrote: > > >Has anyone gotten the call back functions to work via the > >DirectCall interface? I keep getting a Memory access violation. > > > >I am trying to do something like this: > > > >(defun-direct-callback add2numbers ((a long)(b long)) > > (+ a b)) > > > > > >(save-image "math.img") > > > >// SimpleMath.h > > > >. > >. > >. > >typedef long (__stdcall *pfadder)(long, long); > > > >pfadder m_pfAdder; > > > >// SimleMath.cpp > > > > > >STDMETHODIMP CSimpleMath::add(long a, long b, long* c) > >{ > > if(!m_pfAdder) > > { > > > > HRESULT hr = m_iLispCall->GetFunctionAddress > >(L"ADD2NUMBERS",L"WIN32",(LPVOID*)&m_pfAdder); > > } > > > > *c = m_pfAdder(a, b); > > //*c = a + b; > > return S_OK; > >} > > > > > >//end > >The initialize and the BlessThread all return S_OK, the > >connectionpoint to ICormanLispTextOutput is successful, corman text > >output flows through, but it errors out > >on the GetFunctionAddress call. Any ideas out there? > > > > > > > > > > > >To unsubscribe from this group, send an email to: > >[email protected] > > > > > > > >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ ------------------------ Yahoo! Groups Sponsor ---------------------~--> Upgrade to 128-Bit SSL Security! http://us.click.yahoo.com/p7cEmB/s7qGAA/yigFAA/SyjtlB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/