J
James Kanze
[...]I think I really need to c-code, because there are other libraries included
and this section is only part of the whole project. Although am not expert
in making projects.. so not sure. Maybe they could be compiled separately
and then link...
Usually calling C code from C++ is not too much of a problem. You do
compile the C modules separately, and then link the various bits. C++
provides:
extern "C" {...}
for just that purpose.
Calling C code from X++ is never a problem. Calling C++ code
from C isn't a problem either, provided 1) that the functions
you call are declared extern "C", and 2) that the main function
is written in C++ (and that you don't try to propagate any
exceptions through the C code, of course). In practice, the
second requirement can often be dropped: at least under Windows
and Linux (and Solaris, I'm pretty sure), main can be in C as
well, at least if your code is in a separate DLL. (I think the
main for both Python and the Java JVM is in C; their interfaces
are definitely in C; but there are lots of plugins for them
written in C++.)