cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/10/17:15:28.1

From: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Hiding globals when using flex/bison in a library
Date: 10 Jul 1999 12:16:06 GMT
Organization: University of Lulea, Sweden
Lines: 25
Message-ID: <7m7di6$f5g$2@news.luth.se>
References: <4 DOT 2 DOT 0 DOT 58 DOT 19990709130547 DOT 00a5f650 AT hal DOT nt DOT tuwien DOT ac DOT at>
NNTP-Posting-Host: queeg.ludd.luth.se
X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Anton Helm (tony AT nt DOT tuwien DOT ac DOT at) wrote:
: I have a (C-)program that uses 3 different flex/bison pairs to
: parse diferent input files. This works fine with renaming the
: yy_ to something else by commandline switch.
: 
: Now I would like to put some parts of the program into a library.
: The goal is to hide all internal functions of the library from
: the user (using statics and local variables only).
: But flex and bison use global variables to exchange information
: (and define some others too).
: Any idea how to hide these global variables and functions from 
: the user of the library, so they don't conflict with any functions
: and globals on the user's part of the program ?

The easiest solution is not to hide them at all, but use the feature
you mentioned and name them __anton_helm_yy_something_or_other.

An another way (which I don't know works) could be #include the C
files (yes, this is BAD) into one single file and make a little sed
script that makes the global varables static.


Skunk Anansie, Paranoid & Sunburnt,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019