mkshlib on SCO Unix 3.2, "#objects noload" not working?
Roger West
west at osage.csc.ti.com
Thu Jun 14 03:26:12 AEST 1990
I have run into a problem trying to build shared libraries on SCO Unix
3.2. The "#objects noload" directive in the library specification file
does not seem to be working correctly. The following source gives an
example. I am trying to build a simple shared library libf_s containing
a single function funct(). This function calls printf() from the
standard c shared library /shlib/libc_s...
-------------------------Makefile------------------------------------
CFLAGS = -g # -DIMPORT
a.out: main.o libf_s.a
$(CC) -o $@ main.o -L. -lf_s -lc_s
libf_s.a: funct.o
rm -f libf_s.a libf_s
mkshlib -s libf.sl -t libf_s -h libf_s.a
-------------------------libf.sl-------------------------------------
#target libf_s
#address .text 0x80600000
#address .data 0x80a00000
#branch
funct 1
#objects
funct.o
#objects noload
-lc_s
#init funct.o
_libf__iob _iob
_libf_printf printf
-------------------------import.h------------------------------------
#if !defined(import_h) && defined(IMPORT)
#define import_h
#define printf (* _libf_printf )
#define _iob (* _libf__iob )
#endif
-------------------------funct.c-------------------------------------
#include "import.h"
#include <stdio.h>
#ifdef IMPORT
int printf(const char *format, ...) = 0;
FILE _iob[_NFILE] = 0;
#endif
void funct( msg )
char* msg;
{
printf( "%s\n", msg );
}
-------------------------main.c--------------------------------------
#include "import.h"
#include <stdio.h>
extern void funct();
char string[] = "Don't call me DUDE!";
int main() {
int i, k;
for( i=0; i<200; ++i ) {
for( k=0; k<i%(80 - sizeof(string)); ++k )
putchar(' ');
funct(string);
}
}
---------------------------------------------------------------------
With the cpp symbol IMPORT defined, libf_s.a, libf_s, and a.out all
build fine and work correctly. Instead of importing printf and _iob,
however, I should be able to count on the "#objects noload" directive
in libf.sl to resolve them at the time libf_s is built (by searching
-lc_s). If I am correct, this should be what happens when -DIMPORT in
the Makefile is commented out (as shown). Instead, mkshlib prints the
following error message...
mkshlib: fatal error: Found printf in p$, but it's not a usable symbol
*** Error code 1
The fact that this error message doesn't print out a legible filename
is another indication that mkshlib may be not working correctly. Is
it broken, or is there something I am missing?
________________________________________________________
| Roger West Texas Instruments |
| west at itg.ti.com P.O. Box 149149, m/s 2201 |
|___512-250-7372____________Austin, TX 78714-9149______|
More information about the Comp.unix.i386
mailing list