Re: Help- selective symbol exposure after link

root@jacob.remcomp.fr (root)
2 Feb 1997 21:18:41 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Re: Help- selective symbol exposure after link dlmoore@ix.netcom.com (David L Moore) (1997-01-26)
Re: Help- selective symbol exposure after link whsieh@cs.washington.edu (1997-01-29)
Re: Help- selective symbol exposure after link maslen@best.com (Thomas M. Maslen) (1997-01-29)
Re: Help- selective symbol exposure after link aeb@saltfarm.bt.co.uk (1997-01-29)
Re: Help- selective symbol exposure after link albaugh@agames.com (1997-01-30)
Re: Help- selective symbol exposure after link leichter@smarts.com (Jerry Leichter) (1997-01-30)
Re: Help- selective symbol exposure after link root@jacob.remcomp.fr (1997-02-02)
Re: Help- selective symbol exposure after link Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-02-07)
Re: Help- selective symbol exposure after link Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-02-07)
Re: Help- selective symbol exposure after link fjh@murlibobo.cs.mu.OZ.AU (1997-02-08)
Re: Help- selective symbol exposure after link ok@cs.rmit.edu.au (1997-02-11)
Re: Help- selective symbol exposure after link pfox@lehman.com (Paul David Fox) (1997-02-11)
Re: Help- selective symbol exposure after link jan@fsnif.neuroinformatik.ruhr-uni-bochum.de (Jan Vorbrueggen) (1997-02-16)
[2 later articles]
| List of all articles for this month |

From: root@jacob.remcomp.fr (root)
Newsgroups: comp.compilers
Date: 2 Feb 1997 21:18:41 -0500
Organization: Compilers Central
References: 97-01-183 97-01-189 97-01-212
Keywords: linker

Jason Spielman <jason@interval.net> wrote:
  >Q: How does one link several object files into a single object file
  > or library, where symbols are resolved locally as much as possible,
  > and where only selected symbols are exported/exposed/made public?


Under Windows (Win95, Windows NT or Windows 3.11) you can build a DLL
(Dynamic Linked Library). This type of library will ONLY export the
definitions specified in the .def (definitions) file. This is a plain
ASCII file. You will ONLY export the symbols you specify, just as you
want.


: [What gets me is that implementing this stuff shouldn't be very hard. Don't
: know why it hasn't become more popular. -John]


It is VERY popular John. DLLs are a STANDARD way of doing this since
1990 or so for windows developers. It is a pity this is not very well
known outside the windows programmer's world. You specify an ascii
file roughly like:


LIBRARY MyLibrary.dll


EXPORTS MyFunction@1
                MyBuggedFunction@2
MyDebuggedFunction@3
etc etc.


This functions will be visible to the loader, that searches the
corresponding dll and link it to the executable being loaded. All
OTHER symbols in the dll file are INVISIBLE. There is no way to use
them. In the executable you specify which functions you import from
the dll either with a .def file with the IMPORTS keyword, or with a
special declaration in the function definition. At link time you use
an Import Library, that contains stubs for building the import table.


The advantage of developing this way, is that you can change the dll
without touching the executable. If you do not change the interface
definition between the dll and its client, you can ship a new version
of the dll to clients in the field without shipping any other thing.


For references, documentation,etc please read ANY serious book about
windows (3.1 95 NT ANY will do) The literature is copious.


There are drawbacks of course. As with all in life, there is no silver
bullet. If you change the interface for instance, hairy problems can
appear if you have different versions of dll in the PATH variable,
etc. See any discussion of dynamic linking in any windows book.
--
Jacob Navia Logiciels/Informatique
41 rue Maurice Ravel Tel 01 48.23.51.44
93430 Villetaneuse Fax 01 48.23.95.39
France
[Do DLLs still have to work with no static data? I recall that as being
one of their more inconvenient shortcomings. -John]


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.