ProcExists()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

ProcExists()

Post by karweru »

Hello,

Somebody please assist me how to check for procedure existance in harbour. I need to use it to check if a function exists prior to calling it so that it doesn't cause a gpf. When i use procExists(), hmg IDE returns the error "Linkeer .hbmk\win\mingw.....undefined refrence to 'PROCEXISTS'

Merry x-mas to you all.
Kind regards,
Gilbert.
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: ProcExists()

Post by gfilatov »

karweru wrote:Hello,

Somebody please assist me how to check for procedure existance in harbour. I need to use it to check if a function exists prior to calling it so that it doesn't cause a gpf. When i use procExists(), hmg IDE returns the error "Linkeer .hbmk\win\mingw.....undefined refrence to 'PROCEXISTS'

Merry x-mas to you all.
Hello Gilbert,

Try the following function: :arrow:

Code: Select all

Function procExists( cFunc )

Return !( Type ( cFunc + '()' ) $ 'U,UE' )
Usage:
...
mVar := "myFunc"
If !procExists( mVar )
MsgAlert("Function "+ mVar + "() is not defined.")
EndIf
...

Hope that helps. :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: ProcExists()

Post by dhaine_adp »

Function procExists( cFunc )

Return !( Type ( cFunc + '()' ) $ 'U,UE' )
Hi Grigory,

Well, well, simple yet powerful code, Grigory. I admire that, the signature of a master.

Regards,

Danny
Regards,

Danny
Manila, Philippines
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: ProcExists()

Post by karweru »

Thank you so so much Grigory! It works like a charm! Thank you indeed for coming to my aide. Have a very merry christmas!
Kind regards,
Gilbert.
Post Reply