Re: Include decision

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Mon, 06 Nov 2006 13:48:40 -0800, ZNorQ <guest at RapidEuphoria.com>
wrote:

Oops, minor correction (missing eucode statement):

>I'm using a third party include file - TCP4U - but I want to be able to
>turn it off using a global constant ACTIVATE_TCP = FALSE. (This is if
>I'm gonna distribute a version of my program without the TCP4U module
>included. Don't worry, any recognitions are made to the appropriate
>owners.)
I don't and never have had tcp4u loaded, btw
>
>The way it works is that the DLL is 'sequenced' into my application,
>and if the ACTIVATE_TCP = TRUE, it will save the DLL to file - and then
>execute the TCP4U module.
Are you really saying:
constant gunk={blah}
if ACTIVATE_TCP then
  fn = open("zz.dll","w")
  puts(fn,decipher(gunk))
  close(fn)
end if

>
>The challenge (or - problem) is that when I deactivate the TCP4U
>(ACTIVATE_TCP = FALSE) the program shall NOT save the DLL to disk, and
>NOT run the TCP4U wrapper. Only problem is that as soon as I include the
>wrapper - certain initialization routines are already executed, and since
>it wont find the DLL file - errors will emerge.
then eg:
constant zz=open_dll("zz.dll")
if zz=-1 then ?9/0 end if -- or other use of zz

IE: the second half (in tcp4u) does NOT test ACTIVATE_TCP?

Well (assuming the above assumption is correct) the only thing I can
suggest is that you repackage [SEE BELOW!], eg replace:

constant zz=open_dll("zz.dll")
..etc

with
integer zinit zinit=0
atom zz, ..

procedure initZ()
  zz=open_dll("zz.dll")
  ..
  zinit=1
end procedure

global routine a(...)
  if not zinit then initZ() end if
end routine

global routine b(...)
  if not zinit then initZ() end if
end routine


And... Re-Submit This Code to the Archives
(that was the [SEE BELOW!] point above, btw.)
You may feel reluctant, but it is prolly the right thing to do...
>
>What I've done up till now, is modify the wrapper itself with an
>'IF ACTIVATE_TCP = TRUE...' etc, but I don't want to have to edit third
>party snippets..
>
The problem with a [new] constant ACTIVATE_TCP is that it cannot be
defined inside the wrapper, and it will break all legacy use, which
the above ought not to - and if /your/ (ACTIVATE_TCP-wrapped) code
does not call routine a/b/etc, no prob with missing zz.dll, yes?

>Anyone know what walkaround I can use? 
HTH,
Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu