[Mono-list] interesting discussion regarding managed dynamic
libraries
Jonathan Pryor
jonpryor@vt.edu
Thu, 16 Dec 2004 06:46:07 -0500
On Thu, 2004-12-16 at 09:50 +0200, Pieter Breed wrote:
> The idea is this: If you write a managed (hereafter .net for brevity)
> class library could you not "export" certain annotated static methods
> in such a way the a normal C-style application could use those
> functions?
This is already supported at the IL level. Google for "Inverse
P/Invoke", or see:
http://www.blong.com/Conferences/BorCon2004/Interop1/Win32AndDotNetInterop.htm#InversePInvoke
As Ian MacLean already mentioned, this solution isn't portable as it
requires that the native OS linker use PE libraries.
It's also not well supported by most managed languages (C#, VB.NET), as
most do not support global functions and no attributes exist to mark a
static member as a global export.
In short, it can/could be done, but (1) it's not portable; and (2) there
are existing solutions permitting unmanaged code to invoke managed code
(COM Interop and delegate callbacks); and (3) it's not in Microsoft's
long term interests to make it possible. WinFX is the future, and there
is no unmanaged code there. :-)
- Jon