[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua Use in Visual Basic
- From: <miwa@...>
- Date: Fri, 30 Jan 2004 15:03:31 -0800
> Also, if what you say about __cdecl and __stdcall is true,
> then how can I call the DLL at all in VB? It must be figuring
> out what convention the DLL is using I suppose, which the Lua
> DLL won't do when it calls the pointer I give it from AddressOf.
>
> Dang. I don't know anything about firing events in a C
> DLL...looks like I have some reading up for me?
>
>
> Oh, also, I can't seem to get a Lua DLL. I've found plenty of Windows
> distros, but they are all EXEs without external DLLs. Any thoughts?
>
> ~ Isaac
Exported DLL functions are compiled as stdcall, so if the lua stuff declares
the functions as declspec(__dllexport), then they will be usable from VB...
but this isn't your problem...
It's not the C->Lua that you will have problems with, it's handling Lua->C
when lua tries to call back into your VB program. Since that's not going
thru an exported function, the stack semantics will be mixed.
I don't remember all the differences, but I thought the major one was order
that arguments are pushed on the stack. If that's the real one that
matters, then you should be ok, as the callbacks only have 1 param. I don't
remember offhand how the return value is handled, and that may be the
kicker.
Guess you could look at the function prolog and epilog of both a stdcall,
and cdecl function and see if it's a killer. Otherwise you are going to
need a callback dispatcher in C, like the previous poster stated.
Jim