L
Laurent
Hi again,
I created a thread some days ago, while I was trying to access a C++ DLL
using my C# program. First of all, I want to thanks all the guys who helped
me. But I still have a problem... My C++ DLL has a function which has the
following prototype:
long FF_Function(void* inInstance, char* inDate, FF_Struct**
outStructure, long* outNumber);
The structure has the following prototype:
struct FF_Struct
{
long m_Index;
char m_ID[FF_ID_LEN];
char m_Date[FF_DATETIME_LEN];
};
I know that the function should return me an array of FF_Struct, and
that the parameter outNumber has the number of elements stored in the
FF_Struct array. Now, I'm tring to translate it in C#, and here is what I
did (which does not work, of course):
public class FF_AO_OrderList
{
public int index;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = FF_ID_LEN)]
public string numeroCommande;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = FF_DATETIME_LEN)]
public string dateCommande;
}
[DllImport("FF_myDLL.dll")]
public static extern int FF_Function
(
IntPtr inInstance,
[MarshalAs(UnmanagedType.LPTStr)]
string date,
out FF_Struct[] outStructure,
out int outNumber
);
I can access the function, but it returns me an error message ("The
parameters specified for the interface are incorrect."). I don't know how to
deal with this structure and its double pointer. Even in unsafe mode (then I
use a FF_Struct** parameter), I have the same problem.
Does anyone knows what I'm missing ? I'd greatly appreciate some help,
as I'm completely out of ideas... Thanks !!!!
Laurent
I created a thread some days ago, while I was trying to access a C++ DLL
using my C# program. First of all, I want to thanks all the guys who helped
me. But I still have a problem... My C++ DLL has a function which has the
following prototype:
long FF_Function(void* inInstance, char* inDate, FF_Struct**
outStructure, long* outNumber);
The structure has the following prototype:
struct FF_Struct
{
long m_Index;
char m_ID[FF_ID_LEN];
char m_Date[FF_DATETIME_LEN];
};
I know that the function should return me an array of FF_Struct, and
that the parameter outNumber has the number of elements stored in the
FF_Struct array. Now, I'm tring to translate it in C#, and here is what I
did (which does not work, of course):
public class FF_AO_OrderList
{
public int index;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = FF_ID_LEN)]
public string numeroCommande;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = FF_DATETIME_LEN)]
public string dateCommande;
}
[DllImport("FF_myDLL.dll")]
public static extern int FF_Function
(
IntPtr inInstance,
[MarshalAs(UnmanagedType.LPTStr)]
string date,
out FF_Struct[] outStructure,
out int outNumber
);
I can access the function, but it returns me an error message ("The
parameters specified for the interface are incorrect."). I don't know how to
deal with this structure and its double pointer. Even in unsafe mode (then I
use a FF_Struct** parameter), I have the same problem.
Does anyone knows what I'm missing ? I'd greatly appreciate some help,
as I'm completely out of ideas... Thanks !!!!
Laurent