matt.b.williams
10/9/2007 7:34:00 PM
I know I've seen some stuff out there regarding this, but nothing that
has really gotten me closer to a solution quite yet. Possibly part of
the reason is because I'm doing this for a Windows CE device.
I'm writing a DLL within eVC++. A function within this DLL will take
a structure as its only parameter.
>From C# I would like to pass this structure to the DLL but haven't
figured out quite how to accomplish this. From what I've seen, I
probably need to do something with the Marshal class, but could use
some guidance.
Here is some brief sample code.
C++
----------------------------
typedef struct RecordData
{
WCHAR* wszRecordInfo[8];
} RecordData;
extern "C" void __declspec(dllexport) StructureTest(RecordData
records[]){
// Code Here
}
C#
----------------------------
public struct RecordData
{
public string[] wszRecordInfo;
}
[DllImport("SqlCeDLL.dll")]
public static extern void StructureTest(RecordData[] RecStructure);
If it is the case that I would need to use the Marshal class to manage
this, if someone could provide a bit of sample code & additional
insight it would be greatly appreciated. I don't have a lot of
experience with this sort of thing so it would be most helpful.
Thanks in advance.