Hi. I’m working on a native extension that lets me communicate with an Intel RealSense camera from Haxe, under Windows.
I have a basic extension working in Haxe using CFFI Prime, just passing integers and such. But now I want to incorporate some RealSense SDK source into the native code and start passing real data.
I’m having linkage or missing file errors when building the extension with lime rebuild . windows from the projects root. I’ve been trying two methods, one trying to include static libraries, the other trying to include source. I’ve also tried both at once. I’ve been able to produce results from the RealSense SDK in VisualStudio in test projects, but as far as I’m aware I can’t build the native extensions there (please correct me if I’m wrong!).
What is the correct way to compile with Lime/Haxe, including/linking C++ source files from an SDK and static libraries (.lib) in a specified location?
I placed the corresponding cpp file in my project folder because I made some changes to it. Including that was the same as the usual cpp files in the project (still in Build.xml):
<file name="common/libpxc.cpp" />
Still not sure how to include static libraries (.lib).
Unfortunately, I’m still getting my linkage issues. I’ll continue working through it, but I’ll post some details here in case someone has some suggestions.
This is the output from lime rebuild . windows
C:\Development\Haxe\RealSense>lime rebuild . windows
Compiling group: common
cl.exe -Iinclude -IC:/Program Files (x86)/Intel/RSSDK/opensource/include -IC:/Program Files (x86)/Intel/RSSDK/Sample/core/Common/Include -IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include -IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include -IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt -nologo /WX- /fp:precise -DHX_WINDOWS -D_USING_V140_SDK71_ -GR -O2(optim-std) -Zi(debug) -FdC:\Development\Haxe\RealSense\project\obj/msvc19xp/vc.pdb(debug) -Od(debug) -O2(release) -Os(optim-size) -FS -Oy- -c -EHs -GS- -arch:SSE -IC:/HaxeToolkit/haxe/lib/hxcpp/3,4,49/include -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=0(haxe) -D_CRT_SECURE_NO_DEPRECATE -D_ALLOW_MSC_VER_MISMATCH -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -wd4996 ... tags=[haxe,static]
- common/libpxc.cpp
- common/ExternalInterface.cpp
- common/RealSense.cpp
Link: ../ndll/Windows/realsense-19.ndll
Creating library obj/lib/realsense-19.lib and object obj/lib/realsense-19.exp
74631147_libpxc.obj : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "void __cdecl getLocalRuntime(wchar_t *,unsigned long)" (?getLocalRuntime@@YAXPA_WK@Z)
74631147_libpxc.obj : error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function "void __cdecl getLocalRuntime(wchar_t *,unsigned long)" (?getLocalRuntime@@YAXPA_WK@Z)
74631147_libpxc.obj : error LNK2019: unresolved external symbol __imp__RegGetValueW@28 referenced in function "void __cdecl getLocalRuntime(wchar_t *,unsigned long)" (?getLocalRuntime@@YAXPA_WK@Z)
obj/lib/realsense-19.ndll : fatal error LNK1120: 3 unresolved externals
If I’m not mistaken, the particular symbols it can’t find there (RegCloseKey, RegOpenKeyEx, RegGetValue) exist in AdvAPI32.Lib, a file present in the Windows SDK (which I have). I’ve even tried putting that file (x86 version) into the project folder in case it was an environmental path issue, but I had the same result.
I’ve taken the includes and linkage information from a working VisualStudio project and tried to replicated it in my Build.xml, which looks like this:
I’ve not had any luck as yet, but when I have a bit more time to play, I’m going to try building most functionality in VisualStudio where the linkage is working, as a self contained static library. I will hopefully then be able to include that in a simpler interface C++ file for Haxe.