CompuServe Thread

Shared Library Problems

3 messages in this thread
#33993From: Roger NedelApr 6, 1993 5:04 PM
I have been working on creating a shared library lately. Unfortunately, I've run into a brick wall. The following will refer to pages 33-36 of SAS/C 6.0 Library Reference Manual. Here's my test code to see if I can create the simplest library. It is broken into 2 separate files, each with the filename listed in the comment. ============================================================= /*************/ /* testlib.c */ /*************/ #include <exec/types.h> #include <stdio.h> BOOL __asm __saveds printstring (register __d1 STRPTR string) { printf ("%s\n", string); return (TRUE); } LONG __saveds __UserLibInit (VOID) { return (0); } VOID __saveds __UserLibCleanup (VOID) { return; } /**************/ /* testlib.fd */ /**************/ * ##base _TestBase ##bias 30 ##public printstring(string)(d1) * ##end ============================================================= I will run thru each of the steps starting on page 33: 1) I decided on a separate data section for each task. 2) Used <__asm> and <register> keywords as shown above. 3) Created <.fd> file as shown above. 4) Added <__saveds> keyword as shown above. 5) Created <__UserLibInit()> and <__UserLibCleanup()> functions. 6) Compiled <testlib.c> with NOSTACKCHECK and LIBCODE options. All other compiler options were SAS/C default options. 7) I hit the wall when I attempted linking as follows: CD'd to dir with <testlib.c> and <testlib.fd> in it. SLINK libfd testlib.fd \ TO testlib.library \ FROM libent.o libinitr.o testlib.o \ LIB lib:sc.lib lib:amiga.lib My linker chews this up and spits out the following (I simply hit a CR at each prompt for a define value): Undefined symbols First Referenced ================= ================ __OSERR Library 'lib:sc.lib' Module Name '_lseek.c' Enter a DEFINE value for __OSERR (default ___stub): __ProgramName Library 'lib:sc.lib' Module Name '_stub.c' Enter a DEFINE value for __ProgramName (default ___stub): __XCEXIT Library 'lib:sc.lib' Module Name '_exit.c' Enter a DEFINE value for __XCEXIT (default ___stub): Error510: __ProgramName symbol – Near Reference to data item not in near data section. First Reference in Unit _stub.c at offset 00006164 in file 'lib:sc.lib' To Unit _stub.c at offset 00006164 in file 'lib:sc.lib' Any ideas on what I'm doing or not doing??? Thanks for putting up with this novel. – Roger.
#34066From: Robert WilcoxApr 8, 1993 7:41 PM
Use of printf is a no-no as I recall. Also, amiga.lib may have to go in favor of pragmas. Bob
#34079From: Deryk RobossonApr 9, 1993 3:02 AM
Yes, pragmas are the way to go here. Printf IS a no-no. Deryk