x86dos - SQL Server - DB-Library SDK for MS SQL Server
Workarund for link errors occur when DB-Library 6.5 SDK is linked with Borland C++ 4.52.Comments
There are two link errors that prevent the original DB-Library 6.5 SDK from being linked with Borland C++ 4.52 successfully as seen in the following screenshot:
People posted about the same issues on internet many years ago but still get no answers or fixes so far.
And Microsoft has never fixed the issues as it disconnected DB-Library for DOS after SQL Server 6.5.
I thought the fixes would not be so complicate once the causes found, so I decided to find a way to compile DB-Library application with Borland C++ 4.52 by myself.
After some try and error, I came up with the workarounds for the two errors in 2005. I give more details below.
Though now these workarounds may be not helpful to people sought the fixes 10 years ago as they had long moved on to Windows.
1. DOS (pure DOS, DosBox with SQL Server support or 32 bit Windows DOS VM etc.)
Here you can find a copy of my build of DosBox (with SQL Server support):
DOS/DosBox advanced tools
2. DB-Library SDK from Microsoft SQL Server 6.X.
You can get Microsoft SQL Server 6.X on Vetusware
and extract DB-Library SDK out of it.
Some minor changes to .h files and workarounds for link errors are required for it to be usable in Borland C++ 4.52; so I suggest
you download the fixed DB-Library SDK from the following local link: DB-Library SDK,
then unpack the downloaded zip file to a folder (let it be '\dev\sdks\sqlsdk') and set the include
environment variables as follows:
3. DB-Library TSRs from Microsoft SQL Server 6.X.
You can find Microsoft SQL Server 6.X on Vetusware
and extract DB-Library TSRs out of it.
Or you can download DB-Library TSRs from the local link:DB-Library TSRs.
Then unpack the downloaded zip to a folder (let it be '\tools\sqltools') and set the path
environment variable as follows:
4. A Microsoft SQL Server instance (Anything from SQL 4.2 up to SQL 2016).
5. Classic Pubs Sample database.
Local download link:Pubs Sample database.
After the Pubs database downloaded, unpack it to a folder, then attach it to the above SQL Server instance and set up permissions correctly.
Also make sure that Named-pipe protocol is enabled on SQL Server.
6. Borland C++ 4.52 which you can get from Vetusware
Link error 1 - "Undefined symbol GETNODE in bldblib in module DBEXTERN."
Because DB-Library 6.5 SDK was built with an early version of Borland C++ (3.1 I suppose),
some symbols it references are not present in Borland C++ 4.52 and GETNODE is one of them.
Here my solution is creating an empty function put in an assembly code file getnode.asm
for the missing symbol as follows:
;The dummy function is for getting rid of link error "Undefined symbol GETNODE......" in Borland C++ 4.52
GETNODE proc FAR
As GETNODE is not actually used by DB_library, an empty funciton is enought to slient tlink.exe.
Link error 2 - "Undefined symbol _sys_errlist in bldblib in module DBERROR."
The cause of this error is that the real _sys_errlist is overridden by symbol sys_errlist that defined in and they are not the same.
Here my solution is to un-define sys_errlist that defined in and reassign the real _sys_errlist to symbol sys_errlist.
To use the workaround, put the following lines at the beginning of your source file:
#undef sys_errlist /*Workaround for link error "undefined _sys_errlist..."*/
You can check a complete example in file EXAMPLE1.C.
To build EXAMPLE1.C, you can use buildbor.bat included with the download package of DB-Library 6.5 SDK (Fixed for Borland C++ 4.52).
The original BUILDBOR.MAK invoked buildbor.bat has been modified to include getnode.asm, so you don't have to include it in the above command line.