Is there any "InternalCall HowTo"

A

Alexander Müller

Hello!
I want to use an unmanaged class (c++) in managed code.
Unfortunately, the interface is "chatty" and not "chunky"
(read and write single values (double, int, ...) as fast
as possible).
Therefore I want to use the class with InternalCalls.
I see in the rotor source code how to declare the functions,
but I did not find how to import them (from a dll?)
and how the functions are exported. (Also, I am not sure
what constraints I have to follow.)

Is there anywhere a minimal example on how to export
and import a static and a member function as an internal
call?

Alex
 
J

Jeroen Mostert

Alexander said:
I want to use an unmanaged class (c++) in managed code.
Unfortunately, the interface is "chatty" and not "chunky"
(read and write single values (double, int, ...) as fast
as possible).
Therefore I want to use the class with InternalCalls.

You can't. The Microsoft CLR provides no way for extending the set of
InternalCall functions, other than rewriting the runtime itself. You don't
want to do that.

InternalCall is not a magic "make calls go fast" flag. The best solution to
your problem is to use C++/CLI to provide a managed wrapper around the
unmanaged code, converting the chatty interface to a chunky one without
performance loss. C++/CLI was practically designed for these scenarios.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top