🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-sqlserver
Article #1

Re: A link error on MSVC with sql server

#1
From: Jeremy H. Griffith
Date: Sat, 28 Oct 1995 07:15
34 lines
1742 bytes
On 26 Oct 1995 22:54:36 GMT, mis942@chinook.halcyon.com (PACCAR MIS) wrote:

>
>I've been trying to link my MS Visual C++ routine with MS sqlserver 
>w3dblib.lib.  I used standard dblib calls in my routine, but the 
>link fails with a message saying
>
>'error L2029: 'int __far __cdecl dbsqlexec(void __near*)' : unresolved 
>external'
>
>when i do, in fact, specify w3dblib.lib in .mak file. I tried this
>with sqltest3.c that comes in sql-server distribution diskette and it
>works fine. Only when i link w3dblib.lib with .cpp file that i get 	
>this error. i called microsoft for an answer but they won't help me 
>unless i pay them since my msvc is version 1.0. do i have a problem or
>is it my stupid user error(sue)? 

If it works with C but not C++, I suspect that C++ name decoration can
be the problem.  Try:

extern "C" {
#include <w3dblib.h>
}

in your .cpp file, to let the compiler know that the externals in the
library are really C, not C++.  Otherwise the C++ compiler will make
up a decorated name for the function in your .obj, which won't match
what the linker sees in the .lib.

--Jeremy

Jeremy H. Griffith  *  jeremy@omsys.com  *  Voice: 707-876-3412
Fax: 707-876-3256   *  Snail: PO Box 244, Valley Ford, CA 94972 
Fingerprint =  59 9A 30 1D 21 E3 7F DA  C8 4D 61 ED D2 70 8D F5
Technical Details
Message-ID: <46sl93$pnq@news.wco.com>
Path: arc1-ca.pugleaf.net!news.wco.com!news
References: <46p3jc$9t8@news1.halcyon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.wco.com!news
From: jeremy@wco.com (Jeremy H. Griffith)
Newsgroups: comp.databases.ms-sqlserver,comp.lang.c++
Subject: Re: A link error on MSVC with sql server
Date: Sat, 28 Oct 1995 07:15:53 GMT
Organization: Omni Systems, Inc.
Message-ID: <46sl93$pnq@news.wco.com>
References: <46p3jc$9t8@news1.halcyon.com>
NNTP-Posting-Host: mercury11.calon.com
X-Newsreader: Forte Agent .99b.112