[Solved] Failed to import dll in LOVE

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
shimatsukaze
Prole
Posts: 10
Joined: Fri Oct 07, 2016 7:51 am

Re: Failed to import dll in LOVE

Post 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++?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Failed to import dll in LOVE

Post by raidho36 »

That's one option, the other is to wrap C++ code with plain C functions and use "extern C" in DLL declaration.
shimatsukaze
Prole
Posts: 10
Joined: Fri Oct 07, 2016 7:51 am

Re: Failed to import dll in LOVE

Post 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)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: [Solved] Failed to import dll in LOVE

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests