Page 1 of 1

Conditionally compile based on express version

Posted: Tue Sep 05, 2017 8:57 am
by Cliff Wiernik
Changes were made to Express 265 related the inputfocus code block and highlighting/going to the end of the data field in a get. We are still beta testing 265 and using 264 in production so we need to have the new functions in Express 265 available in Express 264 without recompiling the Express libraries.

FUNCTION DC_XbpGetKillInputFocusBlock()
RETURN NIL

FUNCTION DC_XbpGetSetInputFocusBlock()
RETURN NIL

Can this be conditionally compiled in a specific expresss version or do I have do as I have done, which is added a express264.prg file with these functions and when I move to 265 for production, I will delete this code from the project file.

Cliff

Re: Conditionally compile based on express version

Posted: Tue Sep 05, 2017 9:20 am
by rdonnay
I am confused about what you want to do.

You are saying that you want some of the build 265 functionality in build 264?

Re: Conditionally compile based on express version

Posted: Tue Sep 05, 2017 1:45 pm
by Cliff Wiernik
No, I need to stub the two function calls.

YOu made changes to 265 to put the cursor in get fields at the end of the active data, which is causing me problems. You provided two function calls allowing me to post the old code to revert it to 265 behavior. My current code base is based on 265 but I have not yet beta tested 265 in production, which will not be for awhile given my current health condition.

Thus, I stubbed the 2 functions above in my production build based on Express 265 so I do not need to change code. I would prefer to not have to rebuild my 264 express dll at this point so chose this route.

But can you conditionally compile code based on an express version. Otherwise when I go to 265 for production, I will need to just remove this stub code.

Cliff

Re: Conditionally compile based on express version

Posted: Tue Sep 05, 2017 8:18 pm
by bwolfsohn
liff,

What i do in this situation is i put the stub in my own function and call my function instead...

Code: Select all

cus_dc_function()

if new version
  dc_function()
else
  stub
endif

Re: Conditionally compile based on express version

Posted: Wed Sep 06, 2017 5:24 am
by Cliff Wiernik
I am essentially doing that. But I have to put the 2 new functions that are used in 265 into my code which is still running on 264 because the linker needs to see the functions. I do that sort of thing you indicated all the time based on express versions, but I was trying to avoid having to compile in for 264 and remove for 265.

Appears there is not a conditional compile option so I will do as I have done.

Re: Conditionally compile based on express version

Posted: Wed Sep 06, 2017 6:36 am
by bwolfsohn
Unless i'm missing something, you don't need to re-compile...
test for the express version with a local or static var, then execute the if or the else...

one branch calls rogers function, the other branch does whatever it is that you need.....

In the past, when i've had some problems with one of roger's functions, i will write my own replacement.

I put that new function in the else, and roger's origian; function in the if..

function dc_rogerworkaround() // this is the only function that is called from inside the program.
if lVer265
dc_roger() // this is never called andywhere else
elseif lVer264
cus_dc_roger() // this is never called andywhere else
else
something else
endif

Re: Conditionally compile based on express version

Posted: Wed Sep 06, 2017 7:38 am
by rdonnay
Appears there is not a conditional compile option so I will do as I have done.
I thought you were asking me to put conditional compiling in my eXpress++ code.
I couldn't imagine why.

Now I'm guessing that you want the conditional compling in YOUR code.

The only way to do this is to pass a define variable to the compiler in the project file.

COMPILE_FLAGS = /q /n /w /m /b /ga /dEXP265

In your code you would look for that definition:

#ifdef EXP265
// do something
#else
// do something else
#endif

Re: Conditionally compile based on express version

Posted: Wed Sep 06, 2017 12:34 pm
by Cliff Wiernik
Thanks. That is what I think I need.

Cliff