P
Peter Hartlén
Hi!
I've read a couple of threads on this subject but I still don't understand
this simple problem:
I have a C++ dll which exports a function with the following structure:
int GetVersion( StError *err, StVersion *ver);
StError is defined as
struct StError
int iError;
StVersion is defined as:
struct StVersion
char chVersion[16];
int iBuildNumber;
How would I use this in C#?
This is what I first thought to use the followin dllimport definition:
short GetVersion( ref IntPtr err, ref IntPtr ver)
int GetVersion()
{
IntPtr err, ver;
GetVersion( ref err, ref ver);
// How do I reference the actual data of the pointer???
// The C++ equivalent would be something like err->iError (If I'm not
remembering wrong)
if( (int)err == 0 )
{
label1.Text = ver ... ???
}
}
Perhaps the version struct is too complicated to be able to use ordinary
marshalling in CF, but the Error struct shouldn't be, right? So the question
is twofold, how do I reference a pointer argument to retrieve it's data, and
how complicated can the structures be if it is possible to do this way??
/ Peter
I've read a couple of threads on this subject but I still don't understand
this simple problem:
I have a C++ dll which exports a function with the following structure:
int GetVersion( StError *err, StVersion *ver);
StError is defined as
struct StError
int iError;
StVersion is defined as:
struct StVersion
char chVersion[16];
int iBuildNumber;
How would I use this in C#?
This is what I first thought to use the followin dllimport definition:
short GetVersion( ref IntPtr err, ref IntPtr ver)
int GetVersion()
{
IntPtr err, ver;
GetVersion( ref err, ref ver);
// How do I reference the actual data of the pointer???
// The C++ equivalent would be something like err->iError (If I'm not
remembering wrong)
if( (int)err == 0 )
{
label1.Text = ver ... ???
}
}
Perhaps the version struct is too complicated to be able to use ordinary
marshalling in CF, but the Error struct shouldn't be, right? So the question
is twofold, how do I reference a pointer argument to retrieve it's data, and
how complicated can the structures be if it is possible to do this way??
/ Peter