I've implemented some custom marshalling for an external call so that the parameters
being sent gets massaged as required by the external routine. In addition, it is
supposed to massage data after the call. However, while it will do so on the way out,
it's not being driven the other way. I
I'm a little confused by your description. I am not trying to be difficult,
but you use the pronoun it in many places where the antecedent is unclear.
Also, the phrase on its way out is not clear.
Perhaps if you demonstrated the problem using a P/Invoke method with fewer
parameters and
I'll attempt to think before I type this time :-)
I have a a C routine I wish to call that takes the following parameters:
typedef struct XXXCB {
short a;
char b[2];
};
void scumbag(XXXCB *cb, char *v);
for our purposes v is an arbitrarily long string of bytes in the range 0x00-0x7f.
You're making this far too difficult on yourself. See below.
On Thu, 2004-10-28 at 19:57, [EMAIL PROTECTED] wrote:
I'll attempt to think before I type this time :-)
I have a a C routine I wish to call that takes the following parameters:
typedef struct XXXCB {
short a;
char
Unfortunately, UnmanagedMarshal.DefineCustom is a Mono-only class and not part
of .NET. The normal .NET mechanism is to create a custom attribute using
CustomAttributeBuilder to obtain an instance of MarshalAsAttribute with the
custom marshaler specified. That does not seem to work under Mono.
As far as I can tell, Mono supports custom marshalling outside of function
calls (like PInvoke), - ie using Marshal.StructToPtr and PtrToStruct, but
you have to use UnmanagedMarshal.DefineCustom, which would involve reflection
of some sort - possibly creating your class with custom marshalled