dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]P/Invoking C++


From: Marcus
Subject: [DotGNU]P/Invoking C++
Date: Sun, 19 Jan 2003 07:10:49 -0600
User-agent: KMail/1.5

> * You store pointers to C++ objects in C# objects.
> * There is only one P/Invoked method, this method calls functions in C++.
> * The 'invoker' method gets an object pointer (null if class method is
> called) and the name of a class as a string), the name of a method (as a
> string) and the args.
> * The invoker has a really big decision structure (autogen of course :-)
> which based on the class name and the method name finds an entry, executes
> it and returns it's value.
> * The entry is a simply a call to the object (or class).

I haven't actually tested that type of code, but there are going to be some 
runtime penalties for running through all those select statements. Will they 
really be select statements? I didn't think that C++ allowed select on a 
char*.

Also, I have no been successful invoking C/C++ functions from C# where the C 
function takes a variable number of arguments. I don't think that P/Invoke 
really supports that. Gopal said that Pnet supports it, but that is not 
portable. I'm pretty sure that Mono and .NET will have problems with it.

I don't mean to sound discouraging. Overcoming the name mangling problems is a 
big hassle. In the new version of Qt#, we're extracting the mangling names 
from the shared library at build time, in case you're interested.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]