As an 'academic' exercise, I've attempted to create a COM interop assembly
using classes from the Reflection.Emit namespace. The problem that I ran
into was in specifying the
SizeParamIndex for an LPArray.

The generated IL should look something like:

     .method public hidebysig newslot abstract virtual
         instance void  SetArray([in] int32 count,
        [in] int32[]  marshal([+0]) 'array') runtime managed internalcall

but instead, the 2nd parameter looks like (note the missing index argument):

    [in] int32[]  marshal([]) 'array') runtime managed internalcall

with an equivalent C# definition of:

    void SetArray( int count, [MarshalAs(UnmanagedType.LPArray,
SizeParamIndex=0)] int[] array);

I've attached the simplest C# source file that will demonstrate the Emit
code (as far as I can take it). Any ideas on how to specify the array size
parameter index for the marshal keyword?

Peter Partch


===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to