[Mono-dev] P/Invoking libsmbclient from OSX

Konrad M. Kruczyński konrad.kruczynski at gmail.com
Tue Dec 6 16:01:23 EST 2011


Hi,

On Tue, 2011-12-06 at 21:40 +0100, Robert Jordan wrote:
> You must pin the delegate passed to smbc_init, either using
> a field or a GCHandle.

I'd like to add that IMO not pinning but rather prolonging life is
needed here. Pin using GCHandle would cause to pin whole delegate which
would in turn affect memory fragmentation (well, maybe not with boehm
GC, but it shouldn't be a decision-maker here).

P/Invoke requires that when a delegate is marshalled as a function
pointer, immobile pointer is transferred. I think this is implemented in
mono runtimes using set of trampolines.

--
Regards,
 Konrad



More information about the Mono-devel-list mailing list