Re: DLLs [OFFTOPIC]

Richard B. Johnson (root@chaos.analogic.com)
Fri, 17 Jul 1998 08:46:07 -0400 (EDT)


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.

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.108 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
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