MarshalAs(UnmanagedType. EXception
- From: [Yosi] <Yosi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 7 Sep 2005 00:10:03 -0700
I have DLL (unmannaged code) , in this DLL I have some functions and
structures.
one of those functions is GetDataBaseStructure (GDS_Structure *str), the
structure definition is as following :
//// GDS - General Data Structure
typedef struct _T_GeneralTestsDatabase {
int argc;
char *argv[256];//*argv[]
int numberOfStructure; //number of structurs
LPVOID ArrayOfStructurs;//handle array of GDS or TS
} GDS_Structure;
I tring to define such a structure in C# but without succsseed:
[ StructLayout( LayoutKind.Sequential )]
public struct GENERAL_DATABASE_structure //GDS
{
public int argc;
// I G O T Error H E R E
[MarshalAs(UnmanagedType.LPStr, SizeConst=256 )]
public StringBuilder [] argv;//*argv[]
public int numberOfStructure;
// I G O T Error H E R E
[ MarshalAs(UnmanagedType.LPStruct)]
unsafe public void* ArrayOfStructurs;
}
I get an exception when try to execute the function :
GetDataBaseStructure (ref my_GENERAL_DATABASE_structure);
what is wrong how can I define such an unmanaged code in C# ?
.
- Prev by Date: Re: convert letters
- Next by Date: Re: Code Documentation
- Previous by thread: Code Documentation
- Next by thread: Multithreading - writing to same file C#
- Index(es):
Relevant Pages
|