Newsgroups: comp.lang.pascal Path: utzoo!utgpu!watserv1!maytag!watstat.waterloo.edu!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Subject: Re: Linking Turbo Pascal with Microsoft C Library Message-ID: <1991Jun27.144951.27160@maytag.waterloo.edu> Sender: news@maytag.waterloo.edu (News Owner) Organization: University of Waterloo References: <27280@adm.brl.mil> <744@sun4dts.dts.ine.philips.nl> <1991Jun26.100914.834@vax.oxford.ac.uk> Date: Thu, 27 Jun 1991 14:49:51 GMT Lines: 33 In article <1991Jun26.100914.834@vax.oxford.ac.uk> speedy@vax.oxford.ac.uk writes: >> > >:-The reason why they dont fit together is code segment names--Turbos code >segement is called 'CODE' I think TC's is 'DATA' or 'TEXT' or something. >This is also why you cant use the TC library code or any TC code that relies >on it in TP. If you're using TP 6, the rules for segment names are considerably relaxed. Code can be in a segment named CODE, CSEG, or something ending in _TEXT. You can also link in initialized data, as long as the segment name is CONST or something ending in _DATA. Uninitialized data goes in DATA, DSEG, or something ending in _BSS. There are other restrictions, which are in the manual. The rumour I heard to explain this improvement to the linker is that Borland wanted to write the TP 6 IDE in TP, but had to link in the editor & compiler modules which were already in assembler and didn't follow the TP 5 restrictions. The hard parts (which make linking code not specially written for the purpose nearly impossible) are that external references within the .OBJ have to be resolved within the TP code, not in a .LIB; .LIBs aren't supported at all; and some of the names used in libraries aren't legal names within TP. Stony Brook advertises TP compatibility along with mixed language support in their Pascal+, but it hasn't been released yet, and will cost something like $300. TP for Windows lets you link libraries written as DLLs; that might be the best way to go if you're willing to work within Windows. (Something that might be nice: a new program loader for DOS, that can statically load Windows-style segmented executables and referenced DLLs.) Duncan Murdoch dmurdoch@watstat.waterloo.edu