haXe Forum > How to build DLL for cpp.Lib.load()
-
Exey Panteleev Feb 04 at 14:55
I want to create my own DLL haxe extensions (haxe to native C++ app).
I've compiled a DLL in Microsoft Visual C++ 2008 Express Edition:dllheader.h
#ifndef DLLHEADER_H_INCLUDED #define DLLHEADER_H_INCLUDED #ifdef DLL_EXPORT # define EXPORT __declspec (dllexport) #else # define EXPORT #endif #include "lib/include/hx/CFFI.h" extern EXPORT value hello_world (); #endif
main.cpp
#define DLL_EXPORT #define IMPLEMENT_API #include "dllheader.h" EXPORT value hello() { char *str = "Hello world!"; return alloc_string(str); }
I'm put it c:\Program Files\Motion-Twin\haxe\lib\hxcpp\2,05,1\bin\Windows\
and tried out to use it in my haxe class:private static var helloDLL = cpp.Lib.load("dlltest", "hello_world", 0);
but when I started debug it, console is thrown out:
Could not find primitive hello_world__0.
and helloDLL() returns 0
:(How to compile compatible with haxe DLL?
-
heinz hoelzer Feb 09 at 21:02
hi, you should put your question on the mailing list, there it's more likely to get answered.
-
Philipp Klose Feb 09 at 21:16
I never tested it I read that the module system of the cpp is similar to the neko module system. So try something similar to this: C Foreign Function Interface, http://nekovm.org/doc/ffi
< Prev
| Page 1 / 1 |
Next >