On Thu, 01 May 2014 09:56:49 +0100, FrankLike <1150015...@qq.com> wrote:

On Monday, 14 April 2014 at 17:13:56 UTC, FrankLike wrote:

My advice - use ODBC, it is the fastest way you may connect to the SQL server, and you already have everything you need for that. :)

Regards

I have test the d\dmd2\windows\lib\odbc32.lib,the size is 4.5kb,
I test it by test.d(build :dmd test.d)
but find the error:
Error 42:Symbol Undefined _SQLFreeHandle@8
Error 42:Symbol Undefined _SQLSetEnvAttr@16
Error 42:Symbol Undefined _SQLAllocHandle@12
Error 42:Symbol Undefined _SQLGetDiagRec@32
-- errorlevel 4

  I have fixed the errors.
The exe file only 210kb,it works very good.

Where the errors is ?
In the odbc32.def file.
must set the all used function names.
such as:
  _SQLFreeHandle@8      = SQLFreeHandle

That's interesting.

Those functions are _stdcall, so should be exported from the lib as _<func>@<N>.

How did you declare them in arsd.mssql?

You should use extern(Windows) e.g.

extern(Windows) SQLRETURN SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle);

The extern(Windows) tells DMD to look for _stdcall.
extern(C) tells it to look for _cdecl.

The difference boils down to who is responsible for cleaning up the stack after a function call. _stdcall assumes the callee will cleanup the stack, _cdecl assumes the caller will.

R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to