Sun, 30 Aug 2009 11:28:16 -0400, JT wrote: > i'm trying to create a binding for berkeley db dll and quickly ran > into some problems, how do i translate statement below. > > int DB->open(DB *db, DB_TXN *txnid, const char *file, > const char *database, DBTYPE type, u_int32_t flags, int mode);
This is not a valid C or C++ statement, nor a declaration. It's usually hard to translate an invalid code to a different language. > my normal approach would be, > > extern (C) { > int function(DB* db, DB_TXN* txnid, char* file, char* database, DBTYPE > type, u_int32_t flags, int mode) DB->open; > } If open() is a method of DB struct then it uses some sort of C++ calling convention, probably thiscall. Thiscall is incompatilbe with cdecl, so extern(C) won't work. > but real problem is 'DB->open', can anoybody suggest a workaround for > this. DB is just a simple struct (struct DB;) I can only guess here that what you want is extern(C++) interface DB { int open(DB_TXN* txnid, char* file, char* database, DBTYPE type, u_int32_t flags, int mode); } But, without a link to source you try to bind to, it's only a wild guess.