Is there any "InternalCall HowTo"

  • Thread starter Thread starter Alexander Müller
  • Start date Start date
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
 
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.
 
Back
Top