Re: DLLs [OFFTOPIC]

Jeff Noxon (jeff@planetfall.com)
Fri, 17 Jul 1998 09:55:19 -0500


If I understand Erik's question correctly, he's looking for the dlopen(),
dlsym(), etc. functions. There may be cases where you want to use a
shared library without linking the executable to it. I.e., suppose you
want to offer extra functionality if libreadline is present on the system,
but you want the program to run even if it isn't.

Maybe I'm wrong; I missed the beginning of the thread.

Jeff

On Fri, Jul 17, 1998 at 08:46:07AM -0400, Richard B. Johnson wrote:
> On Thu, 16 Jul 1998, Erik Andersen wrote:
> [SNIPPED]
>
> > > > Is there any guideline for writing DLLs in Linux ?
> > >
> > > Shared libraries? ELF?
> > >
> > > Get the libc source and look at the makefile(s).
> > >
> > >
> >
> > I think the question was more directed towards the late binding
> > aspects of DLLs. Shared ELF libraried are bound to an executable
> > at link time. DLLs can be bound at link time (similar to the shared
> > library) or they can be loaded (under Windows anyway) with calls to:
> >
> > CoLoadLibrary(char * lpszLibName, unsigned long bAutoFree);
> > CoFreeLibrary(long hInst);
> > CoFreeUnusedLibraries(void);
> >
> > This facilitates certain types of programming. The question then
> > was probably, what Linux APIs can be used for late binding of a
> > library (comparable to the above mentioned windows APIs).
> >
> > I don't know the answer, and this is off topic, but I would be
> > interested in knowing the answer as well.
>
> Linux and most Unix-like operating systems use a technique called
> 'copy on reference'. What this means is that you never "load" a
> shared library. Components of the library are used as needed. The
> library never has to be loaded so there is no equivalent to the
> Windows DLL. Windows was first run as an extension of DOS. As such
> it was necessary to load "overlays" because to the limited RAM.
> Eventually, these overlays became the normal way of doing things,
> hense the DLLs which are just overlays. In MS-DOS, you can have
> this stuff happen automatically simply by putting () around the
> names of the object files you link to make the executable. In
> Windows, you have to explicitly load and unload overlays. Therefore,
> in this sense, Windows is more primative than DOS!
>
> In Linux, just use 'ld' (man ld) to link your object files together
> into a library file. It's simple.

[snip]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html