c# - IntPtr in 32 Bit OS, UInt64 in 64 bit OS -


I am trying to interpose with C # to C ++ structure. The structure (in the C # wrapper) is something like this: [Layout layouts (sequence, sequence, charset = charset.auto)] Public structure SENSE4_CONTEXT {public system. INTTPT dwIndex; // or UInt64 depends on the platform}

The built-in C ++ structure is slightly unusual, in 32 bit OS, dwIndex to work IntPtr , but in 64 bit OS, it should be in the UInt64 order for interop for work

Any ideas on how to modify the above structure to work on 32 and 64 bit OS?

In the 32-bit unsigned integer you will need to use the UIintPtr , which is 32-bit on UInt32 and 64-bit UIint64 .

It does not seem that your C ++ program requires an unsigned one on the 32-bit platform signed and 64-bit one (though not impossible, at all).


Comments