#Linking problems
11 messages in this thread
Hello,
I have a major problem. I'v been trying some of the source code in the
RKM Libraries manual and I discovered something really nasty. I typed in
the source for a2d.c from page 882 of the manual. I couldn't get it to
link without getting those default _stub messages. The output looks like
this:
Blink – Version 5.10a
Copyright (c) 1990 SAS Institute, Inc. All Rights Reserved.
Undefined symbols First Referenced
_Amiga2Date File 'a2d.o'
Enter a DEFINE value for _Amiga2Date (default _stub):
_CheckDate File 'a2d.o'
Enter a DEFINE value for _CheckDate (default _stub):
_Date2Amiga File 'a2d.o'
Enter a DEFINE value for _Date2Amiga (default _stub):
_GetSysTime File 'a2d.o'
Enter a DEFINE value for _GetSysTime (default _stub):
BLINK Complete – Maximum code size = 8208 ($00002010) bytes
Final output file size = 8228 ($00002024) bytes
Of course, I just hit <return> for all of these since I don't know what a
DEFINE value is. I have checked all my included header files and the
functions were all there. I then checked for the utility.library and I
DON'T HAVE IT!!!!! My RKM's are for AmigaDOS 2.0 and I have an Amiga
4000/040 and AmigaDOS 3.0. Has there been a major change in the number of
libraries included or did someone forget to install them on my machine
before I bought it? I have the following libraries:
68040.library
amigaguide.library
asl.library
bullet.library
commodities.library
datatypes.library
diskfont.library
iffparse.library
locale.library
mathieeedoubbas.library
mathieeedoubtrans.library
mathieeesingtrans.library
mathtrans.library
rexxsupport.library
rexxsyslib.library
version.library
Of course this doesn't tell me why I can't link my code.
Any help would be appreciated.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951
First observation, the xxx.library files in libs: are shared libraries that are
opened by a program at runtime. The linker does not look at them. Also, the
include files just tell the compiler how to call a function. You have to
include the library file in your link command to make the functions available.
The functions you need are contained in amiga.lib.
If you are running the linker from the command line you must include "library
lib:lc.lib,lib:amiga.lib" on the command line or in your "with" file. I think
that if you use the link option on the compiler it will automatically link with
amiga.lib.
Peter Wade
Autopiloting from London, England
Peter,
I know that the #?.library files are shared libraries, but I didn't
know the linker wouldn't check the #?.library file to see if it existed.
The first few lines of the program are:
;/* a2d.c – Execute me to compile me with SAS C 5.10
LC -b1 -cfis -j73 a2d.c
Blink FROM LIB:c.o,a2d.o TO a2d LIBRARY LIB:LC.lib,LIB:Amiga.lib
quit
*/
I am assuming that Blink is linking the Amiga.lib stubs, execept for the
default _stub messages that are all for functions in the utility.library
that I don't have.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951
The linker does not check for the library file because it may not exist and is
not relevent to linking the code. You could well be building the code for a
different machine (or the library may not be coded/compiled yet).
-bill
Bill,
Thanks, I don't know that much about using C, I'm used to programming
in BASIC and Forth. Anyway, I doscovered the problem. I was linking with
the 1.3 version of Amiga.lib instead of the 2.0 Amiga.lib. Another cute
discovery was that I have utility.library. It must be stored in ROM,
because I ran SysInfo and SHAZAM there it was! Anyway, I'm sure there
will be further trial and tribulations from me trying to learn C.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951
James,
It sounds as if you might have a version of amiga.lib that does not have the
stubs for utility.library and timer.device (GetSysTime is actually a library
style call for timer.device). I think utility.library is ROM based, I don't
have a utility.library file in libs: but I do have the library and I am using
3.1.
To check that you have the utility.library try the CLI command:
version utility.library
I don't know much about 5.10 of the compiler but with version 6.5 and above you
can get the compiler to generate inline code to call the library functions by
including <pragmas/utility_pragmas.h> and <pragmas/timer_pragmas.h>.
Peter Wade
Autopiloting from London, England
Peter,
Yes, I had the 1.3 version of amiga.lib instead of the 2.0 version. I
renamed Amiga.lib to Amiga.lib.1.3 and renamed Amiga.lib.2.0 to Amiga.lib
and everything works for now. Actually, I upgraded to SAS C 6.5 and
disposed of the entire problem.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951
The stuff that the linker is looking for is located in file 'amiga.lib',
which should come along with the SAS system.
Hmmm. Copyright 1990? Your compiler might not come with the includes for
the newer 2.0 functions, of course; although the SAS name (rather than Lattice)
suggests you have a fairly recent version.
Look in the compiler directory for LIB (not libs) and see if you can find
amiga.lib there (you MUST!). Then check the docs to see if your path will take
you there during the linking process. It should work .. there's a lotta canned
code in amiga.lib that you can use.
–Jim
Also, you could just use the #pragmas for these functions instead of relying
on amiga.lib. To do this, make sure you #include <proto/whatever.h> where
the "whatever" is the correct include file for the shared library. You
probably already have an include for the <clib/whatever_protos.h>, or at
least you should; since <proto/whatever.h> includes this file, you can
replace it with <proto/whatever.h>.
–Doug
Doug,
I tried that, but I still got the default _stub messages from Blink.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951
Jim,
I think I found the problem. I have 2 Amiga.libs:
amiga.lib 89988
amiga2.0.lib 157880
When I upgraded to the 4000, I renamed the 2.0 includes and headers so
that the compiler and linker would find the 2.0 versions instead of the
1.3 version. I guess I should rename amiga2.0.lib to amiga.lib and try it
again.
Thanks,
p.s. I tried renaming the amiga2.0.lib to amiga.lib and it worked! This
is probably the reason I've had problems with other programs too.
Thanks again.
James Du Bois via AutoPilot
Member of the Bermuda Triangle Exploratory Expedition 1992 – 1951