You have two options:
Make
somestruct
a class, and change the function signature to:[DllImport("MyDLL.dll", SetLastError = true)] public static extern uint GetValue( pHandle handle, somestruct a, somestruct b);
Usually this must not change anything else, except that you can pass a
null
as the value ofa
andb
.Add another overload for the function, like this:
[DllImport("MyDLL.dll", SetLastError = true)] public static extern uint GetValue( pHandle handle, IntPtr a, IntPtr b);
Now you can call the function with
IntPtr.Zero
, in addition to aref
to an object of typesomestruct
:GetValue(myHandle, ref myStruct1, ref myStruct2); GetValue(myHandle, IntPtr.Zero, IntPtr.Zero);