Marshalling int * to C #

I have a function in C ++ void someFunc(char* arg1, int* arg2)that I want to marshal parameters since I use this function in C # (after importing the DLL).

Can you tell me how I should understand, since I am confused here.

[DllImport(Dllname)]
extern void someFunc([MarshallAsAttribute(UnmanagedType,LPStr)] string arg1, IntPtr arg2);

Should I use IntPtr here? I can not pass the address of any int variable from C # so that it falls into a pointer to C ++?

+5
source share
1 answer

A task int*can be used for many different scenarios in C. How you marshal it depends a little on what it means int* arg2.

, int, ref int. , int* , ( , , , ).

+7

All Articles