Re: Help- selective symbol exposure after link

David L Moore <dlmoore@ix.netcom.com>
26 Jan 1997 22:35:05 -0500

          From comp.compilers

Related articles
Help- selective symbol exposure after link jason@interval.net (Jason Spielman) (1997-01-22)
Re: Help- selective symbol exposure after link kaz@nt.com (1997-01-25)
Re: Help- selective symbol exposure after link maslen@best.com (Thomas M. Maslen) (1997-01-25)
Re: Help- selective symbol exposure after link mac@coos.dartmouth.edu (1997-01-25)
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)
[8 later articles]
| List of all articles for this month |

From: David L Moore <dlmoore@ix.netcom.com>
Newsgroups: comp.compilers,comp.lang.c
Date: 26 Jan 1997 22:35:05 -0500
Organization: Netcom
References: 97-01-183 97-01-189
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?


kaz@nt.com wrote:
> This is not possible in the standard C language. An object is either
> visible to the whole project or its private to a single translation
> unit.
> ....
> Looks like you need a different programming language, because in C
> you would have to design your program as above.


The original question is not one that should be shrugged off.


Software engineering techniques, especially those of Booch, promote
dividing up software into subsystems. These subsystems can be
developed relatively independently since each has well defined
interfaces to the others.


Each subsystem has limited access to objects in other subsystems. Each
subsystem will usually contain more than one source file (that way,
you can have teams of more than one member!) and visibility between
files within a subsystem will be greater than between subsystems.


With languages which support separation of church and state, the
compiler can control this by permitting only certain specification
modules to be visible outside the subsystem. This does not work with C
or C++ because you can always redeclare objects rather than import the
appropriate specification (.h)[1]


Perhaps you would not do this, but if you have twenty or more
programmers helping you build your system, are you sure they all would
not do that? How will you check?


So, if you want to write serious software in C or C++, you really need
your tools to support exactly the facility that Jason is asking for.


[1] In C++, you can change the visibility of class elements in this
way too - yetch.
[What gets me is that implementing this stuff shouldn't be very hard. Don't
know why it hasn't become more popular. -John]


--


Post a followup to this message

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