guaco
asked on
Borland Tlinker problem
Hello folks,
I am trying to compile a winsock application using Borland's make version 3.6 and even
though I believe I have created the dependencies right and I have given the right
parameters the TLINK linker still cannot link correctly functions that are in separate
modules and in libraries.
My project is made of three programs (ac_ftp.c, ftp_ctrl.c and ftp_data.c), a resource
file (ac_ftp.rc), a definition file (ac_ftp.def) and two non-standard library
(winsock.lib and winsockx.h). The functions in ftp_ctrl.c and ftp_data.c, as well as
those in the two libraries, are not being found at link time.
The library paths are correct and the c source files and resource file compile just fine
if I initiate an MS-DOS session from windows 3.11. To make things more strange, if I
issue the make command from DOS (no Windows session), nothing will compile.
Enclosed is the makefile and the errormessages obtained. Any help will behighly
appreciated.
Regards,
Felipe Guacache
--------------------------
#makefile
.AUTODEPEND
.PATH.obj = .
# *Translator Definitions*
CC = bcc +AC_FTP.CFG
TASM = TASM
TLIB = tlib
TLINK = tlink
LIBPATH = C:\UTIL\BORLANDC\LIB;..\LI
INCLUDEPATH = C:\UTIL\BORLANDC\INCLUDE;.
# *Implicit Rules*
.c.obj:
$(CC) -c {$< }
.cpp.obj:
$(CC) -c {$< }
# *List Macros*
Link_Exclude = \
.\ac_ftp.res
Link_Include = \
ac_ftp.obj \
ftp_ctrl.obj \
ftp_data.obj \
ac_ftp.def
# *Explicit Rules*
.\ac_ftp.exe: ac_ftp.cfg $(Link_Include) $(Link_Exclude)
$(TLINK) /v/x/c/P=61440/A=16/Twe/L$
c0ws.obj+
.\ac_ftp.obj+
.\ftp_ctrl.obj+
.\ftp_data.obj
.\ac_ftp
nul # no map file
winsock.lib+
winsockx.lib+
mathws.lib+
import.lib+
cws.lib
ac_ftp.def
|
RC .\ac_ftp.res .\ac_ftp.exe
# *Individual File Dependencies*
ac_ftp.obj: ac_ftp.cfg ac_ftp.c
ftp_ctrl.obj: ac_ftp.cfg ftp_ctrl.c
ftp_data.obj: ac_ftp.cfg ftp_data.c
.\ac_ftp.res: ac_ftp.cfg ac_ftp.rc
RC -R -I$(INCLUDEPATH) -FO .\ac_ftp.res AC_FTP.RC
# *Compiler Configuration File*
ac_ftp.cfg: makefile
copy &&|
-R
-2
-u
-v
-W
-vi-
-wpro
-weas
-wpre
-n.
-I$(INCLUDEPATH)
-L$(LIBPATH)
-P
| ac_ftp.cfg
--------------------------
#Error Messages
MAKE Version 3.6 Copyright (c) 1992 Borland International
Available memory 43917312 bytes
bcc +AC_FTP.CFG -c ac_ftp.c ftp_ctrl.c ftp_data.c
Borland C++ Version 3.1 Copyright (c) 1992 Borland International
ac_ftp.c:
Warning ac_ftp.c 552: 'lRet' is assigned a value that is never used in function pascal
Dlg_Main(const HWND__ *,unsigned int,unsigned int,long)
Warning ac_ftp.c 552: 'nAddrSize' is assigned a value that is never used in function
pascal Dlg_Main(const HWND__ *,unsigned int,unsigned int,long)
ftp_ctrl.c:
ftp_data.c:
Warning ftp_data.c 147: Constant out of range in comparison in function
AcceptDataConn(unsigned int,sockaddr_in *)
Available memory 3695252
RC -R -IC:\UTIL\BORLANDC\INCLUDE
Microsoft (R) Windows Resource Compiler Version 3.10
Copyright (C) Microsoft Corp. 1985-1992. All rights reserved.
tlink /v/x/c/P=61440/A=16/Twe/LC
Turbo Link Version 5.1 Copyright (c) 1992 Borland International
Warning: Stack size is less than 1400h. It has been reset to 1400h.
Error: Undefined symbol getaddr(char far*) in module ac_ftp.c
Error: Undefined symbol wsaperror(int,char far*,const void near*) in module ac_ftp.c
Error: Undefined symbol dlg_about(const hwnd__near*,unsigned int,unsigned int,long) in
module ac_ftp.c
Error: Undefined symbol initdataconn(sockaddr_in near*,const hwnd__near*,unsigned int)
in module ac_ftp.c
Error: Undefined symbol createlclfile(char far*) in module ac_ftp.c
Error: Undefined symbol dlg_file(const hwnd__near*,unsigned int,unsigned int,long) in
module ac_ftp.c
Error: Undefined symbol getlcldir(char far*) in module ac_ftp.c
Error: Undefined symbol initctrlconn(sockaddr_in near*,const hwnd__near*,unsigned int)
in module ac_ftp.c
Error: Undefined symbol centerwnd(const hwnd__near*,const hwnd__near*,int) in module
ac_ftp.c
Error: Undefined symbol wsaperror(int,char far*,unsigned int) in module ftp_ctrl.c
Error: Undefined symbol closeftpconn(unsigned int near*,char far*,int,unsigned int) in
module ftp_ctrl.c
Error: Undefined symbol getbuf(unsigned int,int,int) in module ftp_data.c
Error: Undefined symbol gethostid() in module ftp_data.c
** error 1 ** deleting .\ac_ftp.exe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you #include <windows.h> in wsa_err.c?
Actually, there is no wsprintf() function. wsprintf is a #define that resolves to either wsprintfA or wsprintfW depending on whether your application is ASCII or unicode.
Your linker is right again (one smart linker you have there).
Actually, there is no wsprintf() function. wsprintf is a #define that resolves to either wsprintfA or wsprintfW depending on whether your application is ASCII or unicode.
Your linker is right again (one smart linker you have there).
ASKER
I did not code either the module wsa_err.c or the library winsockx.h and do not have the source code. My question was, again, how to avoid the problem without having to recompile winsockx.h. Any ideas?
Thanks!
Thanks!
Where did you get winsockx.lib from?
Is it by any chance a library designed for 16-bit windows 3.x?
If you're compiling for Win3.x, disregard my comment about wsprintf(). You probably forgot to include a library in your app. Try LIBW.LIB or something similar.
Is it by any chance a library designed for 16-bit windows 3.x?
If you're compiling for Win3.x, disregard my comment about wsprintf(). You probably forgot to include a library in your app. Try LIBW.LIB or something similar.
ASKER
Yes, it is a 16-bit windows 3.1x library. The right library was CWM.LIB. By editing it I noticed all the symbols were in uppercase, the linker has an option to omit case I set it and it linked just fine. Thanks for the good pointer Alexo.
Cheers,
Felipe
Cheers,
Felipe
No problem. Have fun!
ASKER
Here is the new error file.
--------------------------
MAKE Version 3.6 Copyright (c) 1992 Borland International
Available memory 48263168 bytes
bcc +AC_FTP.CFG -c ac_ftp.c ftp_ctrl.c ftp_data.c
Borland C++ Version 3.1 Copyright (c) 1992 Borland International
ac_ftp.c:
Warning ac_ftp.c 552: 'lRet' is assigned a value that is never used in function Dlg_Main
Warning ac_ftp.c 552: 'nAddrSize' is assigned a value that is never used in function Dlg_Main
ftp_ctrl.c:
ftp_data.c:
Warning ftp_data.c 147: Constant out of range in comparison in function AcceptDataConn
Available memory 3760984
RC -R -IC:\UTIL\BORLANDC\INCLUDE
Microsoft (R) Windows Resource Compiler Version 3.10
Copyright (C) Microsoft Corp. 1985-1992. All rights reserved.
tlink /v/s/c/P-/Twe/LC:\UTIL\BOR
Turbo Link Version 5.1 Copyright (c) 1992 Borland International
Warning: Stack size is less than 1400h. It has been reset to 1400h.
Error: Undefined symbol _wsprintf in library file winsockx.lib in module wsa_err.c
** error 1 ** deleting .\ac_ftp.exe