[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to use a c module with embedded lua on windows
- From: Paul K <paul@...>
- Date: Sun, 23 Jun 2019 17:13:45 -0700
Hi Marcus,
> The host app does not export its lua API symbols. I had seen some kind of proxy dll on the lua wiki as a workaround but I'm not sure it's updated and/or relevent to my case?
As Andrew wrote, you do need to have the symbols exported if you want
to use the proxy DLL (it basically forwards the calls to the
appropriate addresses in the executable). See my SO answer and the
threads linked there for details:
https://stackoverflow.com/questions/31639483/lua-multiple-vms-detected-while-trying-to-add-extension-for-statically-linke/31639643#31639643.
I've used them with Lua 5.1 and Lua 5.2 and it shouldn't be a problem
to make one for Lua 5.3 if needed.
Another option is to compile everything statically, but if you want to
use external modules that are compiled against a Lua DLL, then the
proxy DLL is your only option.
Paul.
On Sun, Jun 23, 2019 at 4:46 PM Andrew Gierth
<andrew@tao11.riddles.org.uk> wrote:
>
> >>>>> "Francisco" == Francisco Olarte <folarte@peoplecall.com> writes:
>
> >> Thanks for the reply. The host app does not export its lua API
> >> symbols. I had seen some kind of proxy dll on the lua wiki as a
> >> workaround but I'm not sure it's updated and/or relevent to my case?
>
> Francisco> Are you sure it does not? The fact that something DETECTS
> Francisco> multiple VM version hints at two copies being exported,
>
> No, because the detection system doesn't work like that.
>
> Prior to 5.4 (which abandons this particular check), the check (in
> luaL_checkversion) for multiple copies of the interpreter works like
> this: it checks that the lua_version() function which the current module
> is calling is the same copy of the function as the one which was called
> from lua_newstate() when creating the passed-in Lua state. It does this
> by using the address of a static variable defined in that function.
>
> However, the Lua core does try to get its API symbols exported by
> declaring them as DLLEXPORT (which expands to suitable attribute
> declarations unless overridden). With an export library, linking a
> module against the host app would be easy, but since I don't do windows
> myself I have no idea if you can generate this after the fact, or work
> around the absense of it (maybe with a .DEF file? just guessing here).
>
> --
> Andrew.
>