Page 1 of 1 1
Topic Options
#150216 - 2005-10-19 07:10 PM issues with "ERROR : doubly defined UDF"
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
is there a method of working around this issue.


I am INCLUDING a UDF file in some of my scripts, but when I have one app call or run another I am getting the error "ERROR : doubly defined UDF"

I WHY it is happening, but I'm troubled as to how to get around it
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#150217 - 2005-10-19 07:14 PM Re: issues with "ERROR : doubly defined UDF"
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
What I do is define a global in the UDF library, then only call the library if the global is not defined.
Top
#150218 - 2005-10-19 07:16 PM Re: issues with "ERROR : doubly defined UDF"
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Show Me :-)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#150219 - 2005-10-19 08:18 PM Re: issues with "ERROR : doubly defined UDF"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, just simply don't call the same udf again.
_________________________
!

download KiXnet

Top
#150220 - 2005-10-19 08:33 PM Re: issues with "ERROR : doubly defined UDF"
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Thanks Lonk, never thought of that....
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#150221 - 2005-10-19 09:32 PM Re: issues with "ERROR : doubly defined UDF"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK

I knew I could be helpfull

seriously, for "sloppy coders" it could be needed to have a defined("KEYWORD") function.
actually, now as I think of it, it sounds almost perfect!

can I ask...
you said, you are including the udf but do you use pre-tokenized file?
thinking of it, currently it can be bit problematic of CALLing a tokenized script that has included UDFs.
there is no way of limiting the UDFs to that KX-script, right?

obviously, I didn't test this.
just thinking about the scenarios.
_________________________
!

download KiXnet

Top
#150222 - 2005-10-19 09:38 PM Re: issues with "ERROR : doubly defined UDF"
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Rad:

I put all my UDFs in a folder, then use a tool to recursivly resolve which UDFs from that folder are needed to complete the script. The result is a larger script, but it's complete and not dependent on external libraries, thus more portable in my environment. Also, updating the library UDFs won't impact the production scripts until they are re-genned, tested, and distributed.

You can get the KGen tool from my web site - go to the Products section / Admin ToolChest / Kix Development for more info and a download.

You might at least be able to use the resolution routines to include the UDFs. There's an option in the code to either embed the external UDF (which is how I use it) or to insert a reference to the external UDF file via a CALL statement. Using Executes, you might even be able to develope a self-referencing script that automatically loads all needed UDFs at runtime.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#150223 - 2005-10-20 02:55 AM Re: issues with "ERROR : doubly defined UDF"
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

Show Me :-)




For example, in my foobar udf library I have:
Code:
If Not IsDeclared($_LIBRARY_FOOBAR)
Global $_LIBRARY_FOOBAR
End If

Function udfFoo()
EndFunction

Function udfBar()
EndFunction



In the initialisation section of my scripts i have:
Code:

If Not IsDeclared($_LIBRARY_FOOBAR) Call "path\to\foobar.udf" EndIf



This ensures that the foobar udf library is only ever called once.

Top
#150224 - 2005-10-20 03:57 AM Re: issues with "ERROR : doubly defined UDF"
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Richard, I like your approach and will probably be using it in my next interation of my logon script.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#150225 - 2005-10-20 05:29 AM Re: issues with "ERROR : doubly defined UDF"
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Thank you sir...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 978 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.059 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org