` Printed Icetips Article

Icetips Article



ABC: Conditionally setting globals external
2003-01-30 -- Steve Rothkin
 
Newsgroups: TopSpeed.Topic.Suggestions

I was able to take care of this with a few simple modifications of the
templates in C5.5, but I would like to see this as a standard option
in the future.

Basically I have 2 DLLs each built with different dictionaries (NO
files in common). The lower level DLL has to define all of the ABC
stuff (or else the DLL doesn't build). The 2nd DLL needs to reference
functions from the 1st DLL, but also needs to generate the
application/dictionary-dependent ABC globals (filemanagers,
relationmanagers, etc.). With the default ABC templates, this results
in the 2nd DLL giving duplicate defines on

        GlobalRequest
        GlobalResponse
        VCRRequest

There may be others depending on options used for building, but these
are the ones that came up for me.

The solution was very simple so hopefully it can be incoporated into
C6:

In abchain.tpl
  on the general tab add:
        #ENABLE(~%GlobalExternal)
           #PROMPT('ABC globals defined in other
DLL?',CHECK),%ABCGlobalsDefinedExternal,AT(10,,180)
        #ENDENABLE

  in the Global Template Declarations section add:
        #if(%ABCGlobalsDefinedExternal)
        #SET(%ABCGlobDllAttr,',EXTERNAL,DLL')
        #else
        #SET(%ABCGlobDllAttr,'')
        #endif

in abprogrm.tpl
  wherever one of these is defined without an external attribute, add %ABCGlobDllAttr to
the end of the declaration
  i.e.:
        GlobalRequest        BYTE(0),THREAD %ABCGlobDllAttr
        GlobalResponse       BYTE(0),THREAD %ABCGlobDllAttr
        VCRRequest           LONG(0),THREAD %ABCGlobDllAttr

in abbldexp.tpw
  at the %BeginningExports embed change:

    #IF(~%NoGenerateGlobals))
          #INSERT(%AddExpItem,'$GLOBALREQUEST')
          #INSERT(%AddExpItem,'$GLOBALRESPONSE')
          #INSERT(%AddExpItem,'$VCRREQUEST')

  to:

    #IF((~%NoGenerateGlobals) and (~%ABCGlobalsDefinedExternal))
          #INSERT(%AddExpItem,'$GLOBALREQUEST')
          #INSERT(%AddExpItem,'$GLOBALRESPONSE')
          #INSERT(%AddExpItem,'$VCRREQUEST')


Thanks,
---------------------------------------------------------------
Steve Rothkin
Dancemasters Disc Jockey Entertainers, LLC
22A Hawkes Close, Ossining, NY 10562
Email: steve@dancemasters.net   Web: http://www.dancemasters.net
Voice: (914)762-4565   Toll-free (866)FUN-DJMC   Fax: (914)762-4566
Proud member of the American Disc Jockey Association (ADJA) and
the International Special Events Society (ISES)



Printed May 10, 2024, 11:12 am
This article has been viewed/printed 35129 times.
Google search has resulted in 15 hits on this article since January 25, 2004.