It won't be that easy. You also need to make sure that
the target objects are also in the unmanaged memory.
I've been dealing with a similar problem when marshalling
IP_ADAPTER_INFO and other IPHelper routines. You can take
a look at
http://www.alexfeinman.com/download.asp?
doc=GetAdapterInfo.zip for an example of that approach
-----Original Message-----
Thanks, Alex, so you mean...
struct DefinitionParms {
IntPtr phAdapterParms;
int destParmLen;
}
DefinitionParms defParams;
int first = 1;
int second = 2;
int address[2] = { first, second };
IntPtr addressPtr = Memory.AllocHLocal(8); // bet you
can guess what this
does
Marshal.Copy(address, 0, addressPtr, 8);
defParams.phAdapterParms = addressPtr;
defParams.destParmLen = 2;
Memory.FreeHLocal(addressPtr);
in message
Chris,
Obviously, void * phAdapterParms would be translated
into
IntPtr phAdapterParms. You'd need to use Marshal.Copy
to
copy your managed array address[2] to this pointer.
You'd
probably need to allocate some memory before doing
that...
HTH... Alex
--
Alex Yakhnin, MVP
IntelliProg, Inc.
http://www.intelliprog.com
-----Original Message-----
My C isn't what it should be, so can anyone translate
the
following C code
to .NET CF? Many thanks in advance!
struct DefinitionParms {
void * phAdapterParms;
int destParmLen;
};
DefinitionParms defParams;
int first = 1;
int second = 2;
int address[2] = { first, second };
defParams.phAdapterParms = address;
defParams.destParmLen = 2;
.
.