I am currently porting a proprietary dll (API) to C # and I have some problems sorting some of the data types used.
For example, an API header file defines the following types:
typedef unsigned int tINT;
typedef signed int tINTs;
typedef unsigned int tLONG;
typedef unsigned long tPTR;
Then, for example, I have the following function definition:
tINTs SomeApiFunction ( const tPTR hdl, tINT param );
I usually sort intdirectly using C # int( Int32) or an unsigned version. API tLONGand tINTare the same (at least for the API). But I'm not sure with tPTR. I have now done this uintin C # because it is a 32-bit int, but I'm not sure how it longwill behave on a 64-bit machine.
What do I need to do to make sure that the API will work correctly on both 32-bit and 64-bit machines?
Here is what I would do now:
[DllImport( "api.dll" )]
public static extern int SomeApiFunction ( uint hdl, uint param );
, API , , () typedefs. , , .