[Mono-list] internalcall

Jonathan Pryor jonpryor@vt.edu
Tue, 20 Jan 2004 21:43:32 -0500

In internalcall is a function that is implemented within the runtime,
instead of within an external library.  .NET also has them.

In principal, this need not be any different from a normal P/Invoke
call, except that the library isn't specified.  In practice,
internalcalls *could* be more efficient than normal P/Invoke calls as
the marshaller could be more intelligent about marshaling (as it may not
need to assume that the function being called could do "stupid things",
allowing it to skip some safety measures).

I don't know if Mono does anything like that, but .NET, IIRC, will
normally wrap all P/Invoke calls with an exception handler
(__try/__except in MSVC), so that the called function can't kill the
process.  .NET will skip this for internalcalls, for two reasons: (1)
it's faster, as you're not setting up the exception handler;  (2) more
importantly, if the runtime screws up, the process is hosed anyway, so
there won't be much that the exception handler can do for you that
already installed exception handlers (lower in the call stack) can't
already do.

 - Jon

On Tue, 2004-01-20 at 21:22, James Lapalme wrote:
> Hello,
> What are "internalcalls"?
> What is the difference between internalcalls and PInvokes (considering
> I know very well what PInvokes are)?
> Are internalcalls a Mono thing or a .Net thing because I never heared
> about them before?
> Thank you,
> James