[Mono-dev] PInvoke ques
Robert Jordan
robertj at gmx.net
Sun Oct 23 07:28:06 EDT 2005
Shankari,
> My aim is to prevent an update to a pass-by-ref
> value(this is a part of my work in fault isolation).
> My idea is to make a copy of the managed type , so
> this copy will be updated rather than the original
> one.
Well, as Zoltan told you: if the ref parameter is
marked with the [In] attribute, it won't be marshaled
back, at least not with SVN head.
> In order to do this , I need the size of the managed
> object. Does the instance_size denote the size of the
> "managed object" ??
There is no need to reinvent the wheel. The code
is already there. In order to do this you have to mark
the parameter with the [In] attribute.
If you don't want to do this is your C# code, you may
somehow imply PARAM_ATTRIBUTE_IN to the "attrs" field
of the parameter. You can do this in emit_marshal_vtype,
somewhere after "case MARSHAL_ACTION_CONV_OUT".
Needless to say that you're breaking the runtime's
compatibility.
Rob
More information about the Mono-devel-list
mailing list