since a couple of days I try to write a Haxe hxcpp wrapper for linenoise , which is programmed in C code; the library is very simple and the title also contains extern C. I follow the snowman macro template, but I cannot get a way to compile the C module and link it to the rest of the project, I am not sure how to proceed.
I have no problem compiling the code as a C object and associating it with the C executable code on my system (OSX el Capitan), so I assume that I am doing something wrong in my haxe project, maybe I cannot really link hxcpp with the C library, using the build process directly from haxe, or I have to manually do it by writing commands on hand.
@:keep @:structAccess @:include('linenoise.h')
Recently, I get this error:
g++ -o Test-debug -stdlib=libstdc++ -framework Cocoa -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -m64 @/Users/vresko/projects/linenoise/test/cpp/obj/darwin64-debug/all_objs Undefined symbols for architecture x86_64: "_linenoiseClearScreen", referenced from: Test_obj::main() in ab184b9a_Test.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I know this error has several references, but I'm not sure how to solve this problem in the context of haxe hxcpp.
If I use a C ++ wrapper, including hxcpp.h, since the typical linc example makes the same error, the function I declare here (linenoiseClearScreen) is actually a trivial print operation. A.
I also read about other possibilities, such as CFFI for neko, to create a wrapper around the library (maybe I read all about it on the Internet), but I wanted to keep the code static code, if possible, and compatible with all hxcpp goals.