[Mono-list] Why InternalCall rather than DllImport?
Miguel de Icaza
miguel@ximian.com
09 Jan 2002 20:28:05 -0500
> It seems to me that you're going to have the complexity either in C functions or
> in C# classes, and if it's in C# classes, you can isolate those in a
> platform-specific section, if necessary. (ala IOperatingSystem). It's not
> clear to me why implementing the complexity in the runtime is a better decision
> than in C# classes which call the native functions more directly, but that's
> okay.
We look at this problem a few months ago, and decided that it was best
for us to not depend on Dllimport to sort these issues. For example, a
structure like "stat" might have different layouts in different
operating systems and architectures (even on Linux they are different
across ports).
So what we have instead is an intermediate layer in C that does the
translation. This small library needs to be compiled once for each
target (just like the JIT engine, and indeed at the same time as the JIT
engine), but you get to share the same corlib DLL.
Miguel