There's no way to do what you want in C#. 

You could, however, write a wrapper in MC++ and then use the wrapper
from your C# code.

-----Original Message-----
From: Eric Meek [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 18, 2003 6:17 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Prototyping Unmanaged C function in C#


Hello,

Currently I am working on a project where we are trying to call to an
unmanaged function using DllImport in C#.

The function prototype in C is:
    int  netsl(char *, ...);

We have tried using MarshalAs attribute.  However, it only works when
the C# prototype specifies exactly what we are passing to the unmanaged
function. e.g.
  public static extern int netsl(string s, params
[MarshalAs(UnmanagedType.LPArray)] Int32);

Using this method, we'll have to make a C# prototype for each case.
Since this is unacceptable, we have been researching other methods such
as gchandle, pinned reference and __arglist.

Is there a "normal" or usual method of structuring the corresponding C#
method prototype for the DllImport of the C prototype above?

Thanks in advanced,

Eric

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com You may
be interested in Guerrilla .NET, 24 March 2003, in London and Boston
http://www.develop.com/courses/gdotnet

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

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
You may be interested in Guerrilla .NET, 24 March 2003, in London and Boston
http://www.develop.com/courses/gdotnet

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

Reply via email to