M
Mo
Hi,
i am trying to call unmanaged C++ DLL in my C# application
i converted all the structures to be .net compatible (e.g TCHAR to
string (including Marshal As)
one of the functions i try to call is defined in the DLL
bool hhpConnect(Connection_tag* ptag, PTCHAR msg);
where Connection_tag is defined as
typedef Connection_tag
{
.......
}
when i try to call it in C#, i use [DllImport("MyDLL.dll",
CharSet=CharSet.Auto)]
i am not sure how to call the Pointer to a structure? should i use
public static extern bool hhpConnect([Ref,
MarshalAs(UnmanagedType.Struct)]
ref Connection_tag ptag,[MarshalAs(UnmanagedType.ByValTStr)] msg);
i am confused, the *ptag would hold the connection setup parameters..?
also, i think i need to MRashal the string msg too?
how this be different if *ptag was to be changed in the hhpConnect?
Thanks ALL
Mo
(e-mail address removed)
i am trying to call unmanaged C++ DLL in my C# application
i converted all the structures to be .net compatible (e.g TCHAR to
string (including Marshal As)
one of the functions i try to call is defined in the DLL
bool hhpConnect(Connection_tag* ptag, PTCHAR msg);
where Connection_tag is defined as
typedef Connection_tag
{
.......
}
when i try to call it in C#, i use [DllImport("MyDLL.dll",
CharSet=CharSet.Auto)]
i am not sure how to call the Pointer to a structure? should i use
public static extern bool hhpConnect([Ref,
MarshalAs(UnmanagedType.Struct)]
ref Connection_tag ptag,[MarshalAs(UnmanagedType.ByValTStr)] msg);
i am confused, the *ptag would hold the connection setup parameters..?
also, i think i need to MRashal the string msg too?
how this be different if *ptag was to be changed in the hhpConnect?
Thanks ALL
Mo
(e-mail address removed)