[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]Calling C
From: |
Rhys Weatherley |
Subject: |
Re: [DotGNU]Calling C |
Date: |
Wed, 30 Apr 2003 07:36:09 +1000 |
User-agent: |
KMail/1.4.3 |
On Wednesday 30 April 2003 03:44 am, Chris Smith wrote:
> So what is the most appropriate mechanism for doing this with pnet
> PInvoke or that internalCall technique Gopal was talking about?
> I'm concerned with cross-platform-ness here (assuming gpgme is cross
> platform too).
Assuming that pgpme is cross-platform and its C API is relatively clean,
PInvoke should work reasonably portably, even on Windows. There may be some
32-bit vs 64-bit issues (e.g. if gpgme uses "long" then that is different
sizes on 32-bit vs 64-bit platforms). If you isolate the PInvoke stuff in
one class, then modifying the marshalling rules for system-specifics should
be pretty easy.
> So what's concensus? Pinvoke my libs or internalCall - internalCall is more
> efficient isn't it?
Not really. Internalcall doesn't perform any marshalling in the call
mechanism. e.g. unpack an object and convert it into the paramters expected
by the C API. PInvoke does it automatically, but internalcalls require you
to do it by hand. It works out about even performance-wise.
Internalcall was designed for manipulating engine objects, which don't need to
be converted into a different form first to be useful.
Cheers,
Rhys.