FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour change function in runtime
Posts: 422
Joined: Mon Aug 17, 2009 12:18 PM
change function in runtime
Posted: Fri Feb 12, 2010 06:16 PM

Hi,

I would like to change a function in run time mode. This function is in a 3rd party LIB, but in some cases I must change it in runtime mode.

So I can´t have a function with the same name in my code, as I don´t wan´t always to replace it, only sometimes.

Is there a way?. Thank you,. :D

Saludos,



Eduardo
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change function in runtime
Posted: Fri Feb 12, 2010 06:48 PM

Why not use a DO CASE to call whatever function you need?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 422
Joined: Mon Aug 17, 2009 12:18 PM
Re: change function in runtime
Posted: Sat Feb 13, 2010 02:18 PM

James,

I can´t as the function is defined in a external LIB and used very much in the code.

Something linke def/indef but in runtime mode.

Thanks :D

Saludos,



Eduardo
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change function in runtime
Posted: Sun Feb 14, 2010 06:08 AM
Ok, but still couldn't you do a global change of the function name in the app to call a different function that does an IF ELSE statement? You can then set a flag during run-time that determines which function is used.

For example, change all calls to oldFunction() to myFunction() then add this function.

Code (fw): Select all Collapse
function myFunction()
   IF flag()
       oldFunction()  // external function
   else
       newFunction() // internal version of the function
 endif
return nil


You will also need a SET/GET function (flag()) that holds the current value of the flag.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 422
Joined: Mon Aug 17, 2009 12:18 PM
Re: change function in runtime
Posted: Mon Feb 15, 2010 10:38 AM

James,

I can´t do that. I invoke in my code the 3rd party function and it is used many many times.

Saludos,



Eduardo
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: change function in runtime
Posted: Mon Feb 15, 2010 11:52 AM

Mgsoft,

Please review this topic :-)

viewtopic.php?f=6t=12588start=0hilit=symbol

&&&

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change function in runtime
Posted: Mon Feb 15, 2010 08:26 PM
I can´t do that. I invoke in my code the 3rd party function and it is used many many times.


Using Ultra-Edit I can do a search and replace in all files in a project in just a few seconds. Your editor must have a similar function.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 422
Joined: Mon Aug 17, 2009 12:18 PM
Re: change function in runtime
Posted: Tue Feb 16, 2010 10:41 AM

Antonio,

Thanks a lot!!! :D

Saludos,



Eduardo

Continue the discussion