Big Thx but... :)
Is that possible if the structs use types that are not available in C#?
something like this...
struct loService
{
loDriver driver;
unsigned long initphase;
loCaller cactx;
unsigned cform_dataonly,
cform_datatime,
cform_writecompl;
loClient *servlist;
int shutdown; /* indicates the shutdown condition */
unsigned serv_key; /* generator for server's IDs */
lw_mutex lkList; /* servlist & shutdown */
lw_rwlock lkMgmt; /* adding & searching in tags[] */
/* using of allocated tags is unlocked */
/* changing of lastused - through lkSec */
lw_rwlock lkPrim; /* access to tags::primXXX */
lw_mutex lkDr; /* serialise ldSubscribe()
ldWriteTags(), ldReadTags() */
loThrControl update_pipe;
lw_condb lkTridWait;
/* lock secondary, and lasused & other counts,
.state = 1 when secondary updated */
int (*wstrcmp)(const loWchar *, const loWchar *);
int (*wstrncmp)(const loWchar *, const loWchar *, unsigned);
int (*wstrhash)(const loWchar *);
#if 0
int (*wstrnhash)(const loWchar *, unsigned);
#endif
loWchar branch_sep;
unsigned tag_count; /* valid ti is: 0 < ti < tag_count */
unsigned firstfree; /* free ti is >= firstfree */
unsigned lastused; /* valid ti is <= lastused */
unsigned lastnamed; /* valid named ti is <= lastnamed */
loTagEntry *tags;
loTagValue *secondary;
lo_hash *name_hash;
loTrid sec_trid, prim_trid;
#if LO_EV_TIMESTAMP
FILETIME *ts_prim, *ts_sec;
unsigned ts_size;
#endif
/* loTrid prim_changed;*/
struct
loProperty **proplist;
unsigned proplist_count;
void *log;
loService *iam;
};
VivekR wrote:
Hi,
For importing structs, declare the struct
[StructLayout(LayoutKind.Sequential)]
public struct SampleStruct
{
public uint field1;
public uint field2;
}
Declare API function that uses the struct as follows
[DllImport("YourModule.DLL")]
static extern void StructUsage(SampleStruct st);
Hope that helps.
Regards
Vivek Ragunathan
--
Message posted via
http://www.dotnetmonster.com