Re: Qt4, Windows, and Euphoria
Vincent wrote:
>How does one go about wrapping Object Oriented C++ libraries with Euphoria? It
>can be done, Matt has demonstrated that with wxEuphoria. But I just dont
>understand how. Is there some interfacing library?
>
>If there is a C++ interfacing Euphoria library. I would like to have it in my
>library
>
Hello.
I am unsure at what specific libraries are available in Euphoria for
this task.
The key problem to interfacing with C++ code is "name mangling." This
mangling is done by C++ compilers in order to enable overloaded
functions, functions which have the same name but are differentiated
only by their footprint, or the types of parameters they take. Because
of name mangling, a C++ method, say Foo(), could end up being seen by
Euphoria as Z9943_object_Foo6. The process of name mangling is not
random, but it is complicated.
This can be defeated by externing functions. An example:
Given the method void Foo::Bar(int)
You first need to wrap this as a C function, externing it as a C
function in your header file:
extern "C" void Bar(Foo*, int);
The implementation would be
void Bar(Foo *f, int i) { f->Bar(i); }
Bar() would now come through clearly in the shared library, so you could
link it to Euphoria like this:
define_c_proc(thelib, "Bar", {C_POINTER, C_INT})
Regards,
Travis.
|
Not Categorized, Please Help
|
|