China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 02:20
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Network Programming under DOS View 915 Replies 1
Original Poster Posted 2003-07-22 00:00 ·  中国 湖北 武汉 教育网
初级用户
Credits 112
Posts 3
Joined 2003-07-22 00:00
23-year member
UID 7292
Gender Male
Status Offline
Using bc3.1 and the Wattcp development package, all of its sample programs compile fine, but as soon as I link I get an error:
linker error:bad object..........,
I have already set the paths for my header files and library files, and I have also added Wattcp's library file to the project, but no matter what I do, it still won't work.
I saw some posts saying that I need to install a packet driver. How do I install it? How should wattcp.cfg be configured? What directory should it be put in? How should autoexec.bat and config.sys be set up? To achieve TCP/IP communication under DOS, does it have to be real-mode DOS? I'm using WinME and WinXP, so how can I get real-mode DOS?
Please explain the whole process in detail. Thanks!
Floor 2 Posted 2003-09-14 00:00 ·  中国 江苏 扬州 电信
初级用户
Credits 169
Posts 31
Joined 2003-01-25 00:00
23-year member
UID 802
Gender Male
Status Offline
A packet driver is the driver program used to communicate with the network card. You can usually find it on the network card's driver disk. wattcp.cfg is a configuration file only needed at runtime, and it should be placed in the same directory as the program being run. Usually you only need to set two items, the IP address and the mask. The format is:
my_ip=192.168.0.1
netmask=255.255.255.0
my_ip and netmask should be set to your actual address and mask; the above is only an example.
The above two items are required to run the program, but have nothing to do with compiling or linking it. If you can't compile in the integrated environment, you can try compiling from the command line. The command is:
bcc exp1.c -ml -Ic:\bc31\include -Lc:\bc31\lib wattcplg.lib
Here exp1.c is the source program name, the -I option is the directory where the header files are located, the -L option is the directory where the library files are located, and the -m option is the compile mode. The above example uses large mode, so it links Wattcp's large-mode library wattcplg.lib. If you want to debug the program, you can add the -v option, and then use TD for debugging. Also, Wattcp provides a C function library. If you want to compile a C++ program, you need to add the following directive before including the header file:
#ifdef _cplusplus
extern "C"{

#include "wattcp.h"
}
#endif
If necessary, you will need to open wattcp.h, add the above statements before all function definitions, and then recompile the Wattcp library, otherwise link errors will occur.
As for whether real-mode DOS is required to achieve TCP/IP communication under DOS, you can use DOS 6.22 or start Windows 98 in pure DOS mode, but Windows ME and Windows XP will not work. The main reason is that the packet driver must be loaded in real mode.
Forum Jump: