Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check if function exists?
Message
From
27/05/2021 13:12:39
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
27/05/2021 12:48:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680784
Message ID:
01680790
Views:
50
>>Hi,
>>
>>I have a function GetGlobal(2) in my application that shows the name of the DATA folder. But some code runs before this function is defined. And in this cases, I need to use the default application folder.
>
>What does you mean by "before this function is defined"? Sounds like a problem that exists only when relying on procedure files. If there's a PRG named GetGlobal() in the project, it's always available.

I can see several scenarios where an out-of-project code may come into play - dynamically loaded libraries, scripts coming from various tables etc. So some checking whether some of that code is available or not (perhaps code not generated yet?) may be required. Not so outlandish a requirement, I've seen it done (by myself, at times :).

Okay now re-reading the original post... I think he asked the wrong question. The function will be there because it's in the application. But the value it returns may depend on some initialization (reading config or whatever), so the function may return different results, depending on when it is called, before or after that configuration. If that's the case, checking for function's existence is irrelevant - always .t. - some other check is required.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform