You'd at least need a name mangler for MS VC++. I tinkered with
writing one for GCC, which at least has documented mangling. I don't
think MSVC is officially documented (although some other compilers can
produce compatible output).
Depending on what else you do, you'd also need to auto-insert your C++
object as a first argument, potentially read/vector into the virtual
function table, and auto-convert into C++ types (std::string being
rather common).
If your C++ functions are all statics (non-object methods) and only
use C types, then you only have to worry about the name mangling.
There are a number of projects out there that *might* provide easier C+
+ linkage, but most involve boilerplate and code generation, in
addition to some native compilation. See the OTHERS file in JNA's SVN
repo for a list of related projects.
On Apr 8, 2008, at 1:46 PM, Ewan Slater wrote:
Hi,
I've just satrted using JNA, and it's working (hooray), but...
My DLL is written in C++ not C, and when I try to use the
StdCallFunctionMapper it doesn't find my functions in the DLL (boo!
hiss!).
Has anyone got a StdCallFunctionMapper for C++ that they could be
kind enough to send me / point me to?
I'm compiling the DLL in Microsoft VC++, and using the __stdcall
calling convention (but would happily switch to another if that's
what it took).
Cheers,
Ewan