Guy Harris schrieb:
> > In Unix/gcc, I have to compile with "-fPIC", to indicate relocatable object code.
> > What about on Win32?
>
> I *think* shared library DLLs may get assigned a default address, and
> get relocated (and, as in UNIX systems, made unshared) if they don't get
> loaded there, but
>
> 1) I'm not certain of that;
>
> 2) I don't know how that applies to
> explicitly-loaded-by-the-application DLLs.
In Win32 DLL's are compiled with a default base address. The loader
tries to get
the DLL loaded at the specified default address. If this address is
already occupied,
the DLL is automatically relocated to another address, which is choosen
by the loader.
For explicitly loaded DLL's you need to ask the system for the address
of each
function you want to call (same for global variables). The referencing
for that is done by name.
Side effect of the relocation is, that another copy of the DLL is loaded
for every
further application, which needs to access the DLL.......
Gilbert wrote in his first message:
>Can a DLL reference symbols that are not defined within the DLL? Or do I have to
>pass in some struct of function pointers to be able to use the proto_*() and
>dfilter_*() routines available in the Ethereal executable?
Of course can a DLL reference external symbols: It can load another
DLL.....
But - AFAIK - there is no way to import references from the calling
application to
the DLL automatically at load time.
I think, that the only way is to pass pointers to the DLL "by hand" at
initialization.
--
Dr.-Ing. Gerrit Gehnen Abt. LT
ATR Industrie-Elektronik Textilstra�e 2, 41751 Viersen, Germany
Tel. (+49)2162 485-362 Fax (+49)2162 485-100
http://www.atrie.de