Opening and using DLL created with HXCPP

51 views Asked by At

I successfully (hopefully) have created a DLL using HXCPP, however I am having a hard time trying to open and use it with an HXCPP application.
I tried using this, and it works for the DLL (Lib/), but for the Test App (LibTestApp/) I get the error "fatal error C1083: Cannot open include file: 'dlfcn.h': No such file or directory", but I cannot for the life of me find it anywhere.
Plus, that example only shows how the Main.main function is called, and nothing else, which clearly is not too useful.

Anyone knows anything about all this?

1

There are 1 answers

1
Giuppe On BEST ANSWER

The equivalent to dlopen() in Windows should be LoadLibrary: Dynamically load a function from a DLL

However keep in mind that building a DLL using C++ can be pretty unmanageable so in that case you should (manually) write a C wrapper.

A simplified way, if you don't need your dll to be compatible with other non-haxe windows programs, is to write an NDLL instead. NDLLs work for every platform supported by the C++ and Neko target, so (for example) you don't need to write a separate .dll for windows and a .so for mac.