Closed Ilir-Liburn closed 2 years ago
Hey @Ilir-Liburn! Interesting one
What happens if you make a haxe file with just
// Main.hx
function main() trace("hello world!");
And compile it with hxcpp like
haxe --main Main --cpp bin/ -dce full
Do you get the same errors?
Those errors are about CPU registers so maybe there's something related to the CPU architecture to resolve Are you on an ARM computer or a 32-bit computer out of interest?
Hello,
here is the result
Compiling group: runtime cl.exe -D_CRT_SECURE_NO_DEPRECATE -DHX_UNDEFINE_H -nologo /WX- /fp:precise -DHX_WINDOWS -D_USING_V140SDK71 -GR -O2(optim-std) -Zi(debug) -FdC:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin\obj/msvc19xp/vc.pdb(debug) -Od(debug) -O2(release) -Os(optim-size) -FS -Oy- -c -EHs -GS- -arch:SSE2 -IC:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/include -DHXCPP_VISIT_ALLOCS(haxe) -DHX_SMART_STRINGS(haxe) -DHXCPP_API_LEVEL=400(haxe) -D_CRT_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -wd4996 ... tags=[haxe]
C:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin>"C:\HaxeToolkit\haxe\lib\haxe-c-bridge\0,7,0\test\unit\bin\Main.exe" Main.hx:1: hello world!
I thought problem is in cl, e.g. I'm using 32 bit version (you can see that from the C:\Program Files (x86) path), but it is working just fine. I'm surprised about your comment about CPU registers, I'm on Windows 10 Pro x64, i7 1st gen, is that a problem?
I thought problem is in cl, e.g. I'm using 32 bit version
Ahh, that could be related: try removing -D HXCPP_M64
from build-library.hxml and trying haxe build-library.hxml
(The errors about "Rbx" and so on refers x64 CPU registers, so it seems the compiler is compiling in 32-bit mode whereas hxcpp was expecting 64)
It would be best to keep -D HXCPP_M64
and compile with 64 bit cl.exe however
Hello,
yes, that solved the issue, great, thanks.
Now I need to find out how mapping works, e.g. if int,float,double are directly interchangeable, what about Dynamic, is Vector directly mapped to C array, etc. I need this to either build a library (extension) or to embed it into other VM. I think I also need special requirement: reference counting when it comes to GC, and for that I think I have to dig dipper into hxCPP.
Currently it supports C primitives, C callbacks and strings
See the test for a complete view of features
For advanced things like objects you could use a C struct extern https://github.com/haxiomic/haxe-c-bridge/blob/main/test/unit/src/MessagePayload.h
Lots of good discussion about handling arrays here https://github.com/haxiomic/haxe-c-bridge/issues/34
Good luck!
OK, thanks. I have one year (more or less) to do so, there is no rush.
Hello,
run.win from test/unit is giving me error on hxcpp 4.2.1. What I'm doing wrong?
Error: GcRegCapture.cpp C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(53): error C2039: 'Rbx': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(54): error C2039: 'Rbp': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(55): error C2039: 'Rdi': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(56): error C2039: 'R12': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(57): error C2039: 'R13': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(58): error C2039: 'R14': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(59): error C2039: 'R15': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(60): error C2039: 'Xmm0': is not a member of '_CONTEXT' C:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um\winnt.h(7243): note: see declaration of '_CONTEXT' C:/HaxeToolkit/haxe/lib/haxe-c-bridge/0,7,0/test/unit/.haxelib/hxcpp/4,2,1/src/hx/gc/GcRegCapture.cpp(60): error C2660: 'memcpy': function does not take 2 arguments