Article View: comp.windows.ms.programmer
Article #880Turbo C++ and Win3 SDK
From: Mike Moretti
Date: Wed, 12 Dec 1990 20:54
Date: Wed, 12 Dec 1990 20:54
69 lines
2627 bytes
2627 bytes
I have been able to generate Windows3 applications using Turbo C++
and the SDK. I have noticed messages posted that this is not possible.
One reason mentioned the movement of segmetns. You can define a segment
to not be movable in your def file for the linker. I have not found this
to be a problem. The problems I have found were regarding the way
Turbo C++ mangles the names of procs/funcs, the start adress and the
data segment. I beleive that all of these problems have been overcome.
If Bordland provides a windows tool kit and it provides all the
same functionality (including 32-bit memory, etc) then it would be
the preferred choice. However, this is not available now. Below is
a description of how to use Turbo C++ with the SDK.
1. Create a stub.asm file with the following:
extrn __astart:far
end __astart
Use masm to generate a stub.obj file.
2. Add the following to windows.h file:
#define _cdecl cdecl
#define _far far
#define _near near
3. In all of your files add the following at the top:
#ifdef __cplusplus
extern "C" {
#endif
4. At the end of all your files add:
#ifdef __cplusplus
}
#endif
5. In ALL functions/procedures add the _loadds directive. I.E.
int PASCAL _loadds WinMain(....
Note: ALL functions and procedures not just the ones called by windows.
6. Command line compile as follows:
tcc -I\windev\include -I\usr\tc\include -ml! -v -c file.c
tcc -I\usr\tc\include -I\windev\include -ml! -v -Vs -c file.cpp
7. Your link response file should be as follows:
/CO /NOD /NOE /NOI file.obj stub.obj
file.exe,,
cl libw llibcew
file.def
8. In the above link statement the cl.lib file is the original
cl.lib file from Bordland MINUS FBRK and dos\crt0dat.asm.
9. When using sscanf and other library functions you may need to
create the temp storage these routines use. For example:
char ScanTodVector[256] will be needed for sscanf.
If anyone questions the validity of the above feel free to write
to me at mikem@brahms.amd.com
I have recently added a windows interface to an already existing
Turbo C++ program. It appears to run just fine.
Technical Details
Message-ID:
<1990Dec12.205410.16319@amd.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!amdcad!brahms!mikemReferences:
<1990Dec11.132543.7715@watserv1.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!amdcad!brahms!mikem From: mikem@brahms.amd.com (Mike Moretti) Newsgroups: comp.windows.ms.programmer Subject: Turbo C++ and Win3 SDK Message-ID: <1990Dec12.205410.16319@amd.com> Date: 12 Dec 90 20:54:10 GMT References: <1990Dec11.132543.7715@watserv1.waterloo.edu> Sender: usenet@amd.com (NNTP Posting) Organization: Advanced Micro Devices; Sunnyvale, CA Lines: 69