[Mono-list] Wrapping a native library which uses "unsigned long" on 32 bit and 64 bit systems

Robert Jordan robertj at gmx.net
Thu Mar 25 07:06:54 EDT 2010


On 25.03.2010 10:17, Mathias Tausig wrote:
> Hello!
>
> I am writing a wrapper for a c library which uses the c datatype
> "unsigned long" a lot. According to
> http://www.mono-project.com/Interop_with_Native_Libraries , unsigned
> long maps to the .NET type uint on a 32bit architecture and to ulong on
> a 64-bit one.
> Is there some sort of best practice, for achieving to write a library
> which can work on both architectures?

Use [U]IntPtr in the p/invoke signature.

Robert



More information about the Mono-list mailing list