MySQL

DNewbie run3 at myopera.com
Sun Jan 22 16:37:52 PST 2012



On Sun, Jan 22, 2012, at 11:02 PM, DNewbie wrote:
> On Sun, Jan 22, 2012, at 01:13 PM, Mars wrote:
> > On Sunday, 22 January 2012 at 10:21:29 UTC, DNewbie wrote:
> > > I've took a look at MySQL headers, the functions use   stdcall, 
> > > but in libmysql.dll exports table they are not decorated.
> > 
> > This means...?
> > Shouldn't it at least compile, if they are listed in the def 
> > file, coming from the lib?
> > 
> 
> You should add 'extern(Windows)', but it would not work anyway.
> Can someone confirm the oplink does not handle this type of module
> (undecorated stdcall functions)?
> 
> 
> 

You can try

// ----- libmysql.def ---------------
LIBRARY "libmysql.dll"
EXETYPE NT
SUBSYSTEM WINDOWS
EXPORTS
    _mysql_init at 4=mysql_init
// ----------------------------------------

// ----------- mysqltest.d ----------------
import libmysql;
alias void MYSQL;

int main()
{
  MYSQL *m = libmysql.mysql_init(null);
  return 0;
}
// ---------------------------------------------------

// --------------- libmysql.di -------------------
alias void MYSQL;
export extern (Windows) MYSQL *mysql_init(MYSQL *);
// ----------------------------------------------------

$ implib /system libmysql.lib libmysql.def
$ dmd mysqltest.d libmysql.lib

It works..



More information about the Digitalmars-d-learn mailing list