[Mono-dev] MonoType trouble when adjusting method signature
Jonathan S. Chambers
Jonathan.Chambers at ansys.com
Sat Jul 8 11:36:27 EDT 2006
Zoltan,
Thanks for the reply. What should I use to copy the MonoType with? Should I just expose access to the dup_type method, or just write a specific one for my purpose?
A quick question about memory management then. For this parameter I am allocating memory for the type. For another parameter I know it's always an IntPtr, so I use the type from mono_defaults.int_class->byval_arg. In one case I'm allocating memory, in another I'm not. So it seems I am either going to free memory for the mono_defaults type, or else I will be leaking the memory I allocate (both seem bad)?
Thanks,
Jonathan
-----Original Message-----
From: Zoltan Varga [mailto:vargaz at gmail.com]
Sent: Sat 7/8/2006 10:58 AM
To: Jonathan S. Chambers
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] MonoType trouble when adjusting method signature
Hi,
Make a copy of klass->byval_arg, set the 'byref' flag, and the OUT
flag in the copy.
Zoltan
On 7/7/06, Jonathan S. Chambers <Jonathan.Chambers at ansys.com> wrote:
> I have to do some adjustments to the method signatures of the native function calls for COM Interop. In most cases, the return type of a managed method on a RCW is really the last parameter of the COM method call. For example:
>
> C#
> double GetDouble();
>
> C++/COM
> int GetDouble(double* val); // the int return value is the standard HRESULT
>
> In adjusting the signature I have a MonoType* (double in this case) which is the return type. I need to get the corresponding byref version of that MonoType, and apply the PARAM_ATTRIBUTE_OUT attribute to that type's attributes in order to use it as a parameter in the unmanaged method signature. Any advice on how to do this? There is a dup_type method in class.c, but it seems like I'm missing something.
>
> Thanks,
> Jon
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
More information about the Mono-devel-list
mailing list