Open GavinRay97 opened 3 years ago
This is the same when compiling with GCC 11/MINGW, the errors are ver-batim identical to the ones in this issue. Which unfortunately never had a resolution posted 😢
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.0.1/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:\Users\rayga\AppData\Local\Temp\ccZJoPcK.o:test.cpp:
(.rdata$.refptr._ZN2hx15tlsStackContextE[.refptr._ZN2hx15tlsStackContextE]+0x0): undefined reference to `hx::tlsStackContext`
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.0.1/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:\Users\rayga\AppData\Local\Temp\ccZJoPcK.o:test.cpp:
(.rdata$.refptr._ZN2hx7gMarkIDE[.refptr._ZN2hx7gMarkIDE]+0x0): undefined reference to `hx::gMarkID`
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.0.1/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:\Users\rayga\AppData\Local\Temp\ccZJoPcK.o:test.cpp:
(.rdata$.refptr._ZN2hx20gMarkIDWithContainerE[.refptr._ZN2hx20gMarkIDWithContainerE]+0x0): undefined reference to `hx::gMarkIDWithContainer`
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.0.1/../../../../x86_64-w64-mingw32/bin/ld.exe:
C:\Users\rayga\AppData\Local\Temp\ccZJoPcK.o:test.cpp:
(.rdata$.refptr._ZN2hx15gImmixStartFlagE[.refptr._ZN2hx15gImmixStartFlagE]+0x0): undefined reference to `hx::gImmixStartFlag`
To answer this a little – you don't want to include the hxcpp generated header files directly, so the error is caused by #include "./include/Example.h"
. This isn't an issue in hxcpp, but there's an argument to be made that documentation could improve because this is a common error
To use generated hxcpp code externally, you need to tell hxcpp specifically to generate a header suitable to be used this way – this is what @:nativeGen
is for: test/extern-lib/api/HaxeApi.hx. Which enables you to expose simple classes
The MessageBox error can be fixed by linking your application against the standard windows library User32.lib, like with your pragma link.
It looks like struct TLSData in include/hx/Tls.h might be missing a "HXCPP_EXTERN_CLASS_ATTRIBUTES" define inserted before its declaration, and same for 'DECLARE_FAST_TLS_DATA(StackContext, tlsStackContext);' in Immix.cpp
Tried to download Haxe to experiment and see what the story was like for using it to author libraries which expose C ABIs + interop with C/C++:
Compiled the following file:
To C++ using:
And then to test this, I wanted to try to it out by calling:
But on compilation, this gives ☹️