[Mono-dev] Fwd: Providing Managed Implementations for P/Invokes - Was: [Mono-winforms-list] Caret
monoman at gmail.com
Fri Mar 9 09:33:55 EST 2007
Forwarding this to discuss in a broader audience.
---------- Forwarded message ----------
From: Rafael Teixeira <monoman at gmail.com>
Date: Mar 9, 2007 11:28 AM
Subject: Re: [Mono-winforms-list] Caret
To: George Giolfan <georgegiolfan at yahoo.com>
Cc: mono-winforms-list at lists.ximian.com
Interesting idea, but that kind of redirection isn't presently possible.
Mono has some logic on mapping p/invoke calls (using .config files
even for dlls) but AFAIK it is just to point to some other native
library and function entry-point, still doing the marshaling of things
as needed for the native platform.
Just extending it to allow mapping to managed implementations would
still put the burden of creating the mapping .config files/sections
for porting devs, or packagers.
A middle ground solution would be to either hardcode the mapping
inside the runtime (a magic xml file, for instance), or allow for some
"exporting" configuration section on .config (or some managed API) to
add the mapping by the API providing assembly, but this latest
suggestion seems risky, security-wise, because it could allow any
assembly to "sequestrate" some native API, even more as full CAS and
trust-management isn't working on Mono
Discussion on risks, benefits, and also code contributions to test the
premises are all welcome.
On 3/9/07, George Giolfan <georgegiolfan at yahoo.com> wrote:
> If you mean implementing such functions in native code
> is wrong, I completely agree. I was suggesting we
> could implement Win32 functions (those that do not
> have managed equivalents) in managed code and have
> Mono call them when it encounters a P/Invoke (I am
> under the impression that this is possible). This way
> we wouldn't need to change every program we want to
> port. There are already methods in XplatUI very
> similar to the caret Win32 functions.
> --- Rafael Teixeira <monoman at gmail.com> wrote:
> > Having a libuser32.so, and possibly others, to
> > enable all that
> > p/invoking seems a bit too much for me.
> > We should strive to keep all we can in managed-land,
> > where things are
> > naturally more portable.
> > Just my thinking on the subject,
Rafael "Monoman" Teixeira
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw
More information about the Mono-devel-list