L
Laurent
Hello,
I received a C++ DLL and I must include it in my C# programm. The
problem is that I don't know how to convert the parameters from C++ to C#,
specialy when there are pointers in it. There are 2 fonctions I would like
to convert.
The first one has only one parameter, but I don't know how to deal with
the void type.
[C++]
long myFunction1(void ** parameter);
I tried this, but it does not work:
[C#]
[DllImport("MyDLL.dll")]
public static extern long myFunction1(ref IntPtr parameter);
The second one has a double pointer to a structure. I think I dealed
with the structure, but what about the double pointer ?
[C++]
long myFunction2(myStruct** parameter);
with myStruct defined as:
struct FF_AO_ImageList
{
char structParameter1[30];
long structParameter2;
}
[C#]
[DllImport("MyDLL.dll")]
public static extern long myFunction2(??????);
with myStruct defined as:
public struct FF_AO_ImageList
{
[MarshalAs(UnmanagedType.ByValTStr), SizeConst = 30]
public string structParameter1;
public long structParameter2;
}
I hope it's not too difficult to understand, however I'll explain again.
I hope someone can help me ! Thanks...
Laurent
I received a C++ DLL and I must include it in my C# programm. The
problem is that I don't know how to convert the parameters from C++ to C#,
specialy when there are pointers in it. There are 2 fonctions I would like
to convert.
The first one has only one parameter, but I don't know how to deal with
the void type.
[C++]
long myFunction1(void ** parameter);
I tried this, but it does not work:
[C#]
[DllImport("MyDLL.dll")]
public static extern long myFunction1(ref IntPtr parameter);
The second one has a double pointer to a structure. I think I dealed
with the structure, but what about the double pointer ?
[C++]
long myFunction2(myStruct** parameter);
with myStruct defined as:
struct FF_AO_ImageList
{
char structParameter1[30];
long structParameter2;
}
[C#]
[DllImport("MyDLL.dll")]
public static extern long myFunction2(??????);
with myStruct defined as:
public struct FF_AO_ImageList
{
[MarshalAs(UnmanagedType.ByValTStr), SizeConst = 30]
public string structParameter1;
public long structParameter2;
}
I hope it's not too difficult to understand, however I'll explain again.
I hope someone can help me ! Thanks...
Laurent