Comments (11)
The compiler driver program has limitations. When you define the HITECH environment variable, it will assume all your libraries are in the drive/user area you set it to. You can, however, specify the library file name on the command line and it will be passed to the linker - e.g.
D>c -v -o -x -i0:d: vicdemo1.c 0:d:libc3l.lib
If you look at the source-code to the driver program (in the repo file CPM/C309-16.C) you’ll see the processing of the -L option just prefixes the HITECH path and LIB to what you specify (e.g. In your case -lc3l becomes 0:B:LIBC3L.LIB).
Tony
from hi-tech-z80-c.
This doesn't work when you need the second pass i.e. c -o -x -i0:d: -lc3l -lc3l vicdemo1.c which works if I copy the lib to b:. You get undefined symbols error. In this case you need:
D>c -v -o -x -i0:d: vicdemo1.c 0:d:libc3l.lib 0:d:libc3l.lib
from hi-tech-z80-c.
The ordering of modules in your library may need to be adjusted to reduce//eliminate references to object modules that have already been scanned by the linker. Repeating the library (as you found out) also is a work-around. This is a limitation of the one-pass linker. I found I needed to do this too with the standard libraries after I tinkered with them.
from hi-tech-z80-c.
I actually got this from the the original docs back in the 90s. Are you saying my includes need to be recorded? It only happens on 2 programs. Or are you saying libr order needs to change. How do I know the proper order?
from hi-tech-z80-c.
If you get a listing of the modules in your library - some of your object modules may have externals that make backward references to another library module (which the linker has already scanned past). It could be as simple as re-ordering the modules in your library to only have forward references (so the linker can resolve them by reading more modules from your library in its single pass).
D>libr s 0:d:libc3l.lib
will show the modules and references.
from hi-tech-z80-c.
I should add - sometimes you can't make all modules do forward references only. In this situation you can add a duplicate copy of a module when you create the library. e.g. where module1 references module2 symbols and module2 back references module1 symbols, then you can add module1 to the library twice
using -
libr
libr> r libtest.lib \
libr> module1.obj \
libr> module2.obj \
libr> module1.obj
from hi-tech-z80-c.
I assume (didn't read libr docs) D means down reference and U means up reference?
from hi-tech-z80-c.
In the module listing from libr, D means the symbol is defined by the module, and U means the symbol is undefined (or external) to the module.
It is the undefined ones that the linker tries to resolve by reading forward through the libraries. If one of the modules it has loaded previously has defined the symbol it will use it - but it won't go backwards looking for previously unloaded modules to resolve it. (I hope my explanation is clear).
from hi-tech-z80-c.
Oh yeah, normally you don't deal with this stuff, but it's like a 2 pass assembler figuring out forward references. Cannot do it in a single pass. I'll figure out the order, thanks. I haven't played with HTC for about 5 years. Before that it was the early 90s.
from hi-tech-z80-c.
Modern linkers solve this by performing multiple passes. There are linkers for CP/M that can do multiple passes (like Phoenix PLINK-II and perhaps Microsoft L80) - but the object file format from HITECH C is not compatible with them.
from hi-tech-z80-c.
It was easier to use the undefined symbols error
output then just move that obj file to the bottom once you figure out which one it is. libr s
didn't really help (or at least from what I could tell). In any event, you pointed me in the right direction and this will hopefully be bread crumbs for others to follow. Thanks again.
from hi-tech-z80-c.
Related Issues (20)
- new C.C frontend not running on ZXCC HOT 9
- Extraction aborting - overlay.h isn't working HOT 4
- bios() calls to invoke XMOVE and MOVE fail under DRI banked BDOS HOT 2
- Wrong prototypes for ctime, gmtime and localtime HOT 1
- Work related to Hi-tech C HOT 1
- Hi-Tech C MSDOS v7.80 HOT 5
- LIBC library object modules need re-ordering HOT 1
- Undefined symbols with build 13 ( _open, _fseek, _creat, __filbuf) HOT 5
- Can't execute $EXEC HOT 4
- Cannot sseem to include libraries on different drive HOT 1
- It doesn't run on the Agon Light yet and it's not 24 bit to suit the eZ80 CPUs HOT 1
- Resulting com files bigger than original compiler HOT 7
- Linking question HOT 2
- I'm getting a "can't create testprg.obj" HOT 3
- Passing struct as argument to function pointer inside struct HOT 1
- Can you detect if include defined? HOT 3
- Running out of memory HOT 2
- Better way to pass args from C to ASM HOT 5
- module has code below file base of 0100h HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hi-tech-z80-c.