Re: shared libs in circle (was: C++ compiler warnings with dlsym())

From: Anil Mahajan (amahajan@PROXICOM.COM)
Date: 03/08/99


On Thu, 4 Mar 1999 22:43:55 -0500, Mark A. Heilpern <heilpern@mindspring.com> wrote:

>No linking stage would mean you have a bunch of .o files (assuming more than

   You can include multiple source files into a library.  Linking still
should not occur, because with a shared library you are permitted to point
to functions and variables that you currently don't have compiled in (Such
as 'character_list', 'descriptor_list', and any number of other globals or
functions).
   This makes it a bit harder to debug, since you won't get the compiler
warnings for undefined references.  Though, you will get warnings if you
don't 'extern' the variables you're going to get from the MUD.

>1 .c goes into the library). How do you create the .so from the .o's?
>(Sorry if this
> is a basic question for shared object creators; hopefully other CircleMUD
>coders are finding mud-related value in this.)
>

  Yes, first you take each .c file and turn it into a .o file.  No linking
occurs at this point (even in a regular non-library build).

>Without looking at other source and without further man-page reading, I'm
>assuming if I have: foo.c and bar.c; and I "cc -c *.c" to create foo.o and
>bar.o,
>I can then "cc -shared -rdynamic -nostdlib foo.o bar.o -o myobject.so"; is
>this off base?
>

  You've got it.  This is for gcc at least.  The options may very from
compiler to compiler.  I've had to do some wierd things in the past
with solaris cc, that I can't recall.

- Anil


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST