VGA Mode X - linker error in Borland Turbo C++ 3.0

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
celaeno
Posts: 3
Joined: Sat Apr 01, 2023 7:39 am

VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by celaeno »

Hello,

I got XLIB06 from the internet, a VGA mode X Library. I tried to comple the "demo1.c" in Borland C++ 3.0 with dosbox. But when I do Compile -> Build all, I get 26 linker errors.
cm1RITh.png
[moderator: fixed attachment]

I have added c:\tc\xlib06 to the include directories and also to the Library directories.

Does anyone maybe know how exactly to compile this?

I think I also need Borland Turbo Assembler, I installed version 5, but maybe that's a too high version? I set the dos path "Set path=c:\tasm"

Edit: I tried "tasm *.asm" and some files succesfully compiled but some gave errors. Is maybe TASM 5.0 a too high version for Turbo C++ 3.0?
User avatar
aa-dav
Posts: 220
Joined: Tue Apr 14, 2020 9:45 pm
Location: Russia

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by aa-dav »

I downloaded it and it seems pretty clear.
First of all there are XLIBREF1.DOC and XLIBREF2.DOC with instructions for building (assembler modules have special mention in it).
Second - there is MAKEFILE to build demos with single command line 'make' ('make all'). Your %PATH% needs to contain path to BIN folder of tasm and bcc. Also %LIB% and %INCLUDE% must be setted up to corrresponging paths to LIB and INCLUDE folders (of BCC directory too!).
Main goal is simple: to compile every *.c and *.asm intro correspoing .obj file which linker seeks and links to EXE at the final stage of compilation. This can be done one-by-one manual steps or in batch via makefile.
But pay big attention to the memory model options - it's vital for DOS C to maintain the same memory model across all compilation units.
'Too high assembler version" must not be the problem. There is strong backward compatibility in such things.
If there are errors during manual compilation - it's vital to eliminate them one by one too.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by Oziphantom »

you would also need to add the lib to the linker options, something that old is not going to have auto lib or #pragma linkage and will need to manually add it to the linker config in what ever you are using to build it.
celaeno
Posts: 3
Joined: Sat Apr 01, 2023 7:39 am

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by celaeno »

Thanks for your help!

I only used Turbo Pascal with Assembly inline statements in the past. I didn't notice the DOCS, only the readme, so thanks. Do you maybe know where I can download the TLIB program for DOS, mentioned in the DOC?

Do you mean with bcc the command line compiler? Then I think it's tcc.exe in Turbo C++?
Also %LIB% and %INCLUDE% must be setted up to corrresponging paths to LIB and INCLUDE folders (of BCC directory too!).
Sorry, I don't exactly understand what you mean with %LIB% and %INCLUDE% , do you mean to also set those paths in the autoexec.bat?

And do you maybe know if there is a good tutorial how to use Turbo C/C++ with Turbo Assembler outside the doc?
you would also need to add the lib to the linker options
What do you mean with the Linker options, is that something else than setting up the include directories and Library directories in Turbo C++ ? Do you maybe know where I can set the linker config?
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by Oziphantom »

TLIB should be included with the borland c, its a core part of the package so it should be there with the other tools.

you can't just give a c compiler a folder and then magically have it know which lib it needs to load in said folders. you need to tell it which lib it needs. From memory the tlink takes it as the last param in a comma list. but this is a case of for your particular version you are going to need to read the manual, all 3 inchs of it ;)
something along the lines of tlink -e -L<lib paths> a.obj b.obj etc,name.exe,first.lib second.lib might have the order wrong and be missing something.. probably has a config file as well, it's been decades.
celaeno
Posts: 3
Joined: Sat Apr 01, 2023 7:39 am

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by celaeno »

Haha oke thanks, I didn't know it was that complicated. I now understand that Borland C++ is something different than Turbo C++, I'm going to install also Borland C++ . I see that the compiler in the makefile is set to BCC :)
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by Oziphantom »

oh yeah I forgot about that! Turbo was the "lite" cheaper "hobby" versions wasn't it?? In they are both made by Borland.. confusing as...
User avatar
aa-dav
Posts: 220
Joined: Tue Apr 14, 2020 9:45 pm
Location: Russia

Re: VGA Mode X - linker error in Borland Turbo C++ 3.0

Post by aa-dav »

celaeno wrote: Mon Apr 03, 2023 7:19 am
Compiler needs to know there include files are located. Linker needs to know there .obj and .lib files are located. You can pass this information to them via command line or specify them in the system variables (like %PATH%). They are %LIB% and %INCLUDE% system variables.
This concept still lives and MS VC++ has msvcvars.bat or something like that in the distro to setup these things. And in linux it's totally global system variables.
Note that linkage of .obj files into .lib is not vital step. It's just for convienence.
Post Reply