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

Alan McGovern alan.mcgovern at gmail.com
Thu Mar 25 07:11:32 EDT 2010

Yes, that will work, right up until someone runs the library on 64bit
windows :) If you don't care about that platform, this would be the
easiest way to work in nearly all of the other platforms.


On Thu, Mar 25, 2010 at 11:06 AM, Robert Jordan <robertj at gmx.net> wrote:
> 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
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list