lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Alright, so I dug deeper into this issue, since the Open Dynamics
Engine is triggering this issue now (and it's the only 3D
physics/collision engine with a C API I can find)

Apparently, loading a C++ library compiled with msys g++ causes LuaJIT
to crash when the process exits, even after the DLL was unloaded (I
set a breakpoint in lj_cf_os_exit, it crashes when exit() gets
called), even if the only calls through the FFI are those to extern
"c" functions. A small C program that just loads then unloads the
library works fine.

Here's the example code I'm using:
https://gist.github.com/ColonelThirtyTwo/5286862

I don't think this has to do specifically with C++ code however. SOIL,
which is what I was having issues with earlier, is written in C, yet
still causes crashes, so I'm not quite sure.

May you please take a look into this, Mr. Pall?
Thanks, Alex Parrill

On Fri, Dec 30, 2011 at 5:04 PM, Alex <initrd.gz@gmail.com> wrote:
> Mike Pall <mikelu-1112@mike.de> wrote:
>> Does the same thing happen if you load the DLL from C with
>> LoadLibrary()? For better comparison use the same C compiler
>> as you've used for LuaJIT.
>
> Yea, it does, so it seems like it's a problem with the DLL itself. A
> quick google yielded this topic:
> http://stackoverflow.com/questions/6001176/why-does-a-mingw-compiled-dll-cause-a-crash-on-exit-when-compiled-without-stati
> which may be the problem, as the library stores the error messages as
> well as the availability of certain OpenGL extensions in global
> variables. Other than that, I'm at a loss as to what is causing it.
> Any ideas?
>
> Again, thanks for the help.