Page 2 of 2
Re: Failed to import dll in LOVE
Posted: Sat Nov 12, 2016 2:33 am
by shimatsukaze
raidho36 wrote:You can't really use a C++ library that was built with a different compiler than the main executable, due to name mangling and all the other fun C++ stuff. You should instead use C wrapping, as it is was done for long time now. This wouldn't have been an issue had C++ standard these things properly defined, but that's not meant to be. Also this may be the culprit of this particular case, since LuaJIT can't load a C++ library that was built with a different compiler.
Thank you. It seems that LOVE load the name of C++ functions correctly but failed to run them...
Do you mean that I should use C instead of C++?
Re: Failed to import dll in LOVE
Posted: Sat Nov 12, 2016 2:40 am
by raidho36
That's one option, the other is to wrap C++ code with plain C functions and use "extern C" in DLL declaration.
Re: Failed to import dll in LOVE
Posted: Sat Nov 12, 2016 2:45 am
by shimatsukaze
raidho36 wrote:That's one option, the other is to wrap C++ code with plain C functions and use "extern C" in DLL declaration.
Thank you! LOVE works when I compile my codes in C.
(Although I still don't quite understand what caused the problem)
Re: [Solved] Failed to import dll in LOVE
Posted: Sat Nov 12, 2016 2:50 am
by raidho36
Most likely name mangling. C++ standard doesn't properly defines dynamic link library ABI so every compiler can do however it pleases, and any two different interfaces are incompatible. C on the other hand has every relevant thing very specifically defined and it's practically a universal benchmark in terms of compatibility, so if a code that uses standard C works in one place, it will work in any other place that has standard C implemented.