Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move process-architecture check to runtime #103

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DataDigger2.p
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,9 @@ PROCEDURE recompileSelf :

IF COMPILER:ERROR THEN
DO:
ASSIGN lCompileError = TRUE.
/* this file doesn't need to compile/run on versions under 11.3 */
IF bOsFile.cFileName <> "getProcessArchitecture.p"
THEN ASSIGN lCompileError = TRUE.
IF bOsFile.cFileName <> "myDataDigger.p" THEN lCoreFileError = TRUE.
END.
END.
Expand Down
8 changes: 6 additions & 2 deletions DataDiggerLib.p
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ DEFINE TEMP-TABLE ttFont NO-UNDO
* See for more info:
* https://knowledgebase.progress.com/articles/Article/Windows-API-call-fails-with-error-13712-in-11-7-64-bit
*/
&IF DEFINED(PROC-ARCH)=0
&THEN &SCOPED-DEFINE PROC-ARCH PROCESS-ARCHITECTURE
&ENDIF

&IF PROVERSION >= '11.3' &THEN /* PROCESS-ARCHITECTURE function is available */
&IF PROCESS-ARCHITECTURE = 32 &THEN /* 32-bit pointers */
&IF {&PROC-ARCH} = 32 &THEN /* 32-bit pointers */
&GLOBAL-DEFINE POINTERTYPE LONG
&GLOBAL-DEFINE POINTERBYTES 4
&ELSEIF PROCESS-ARCHITECTURE = 64 &THEN /* 64-bit pointers */
&ELSEIF {&PROC-ARCH} = 64 &THEN /* 64-bit pointers */
&GLOBAL-DEFINE POINTERTYPE INT64
&GLOBAL-DEFINE POINTERBYTES 8
&ENDIF /* PROCESS-ARCHITECTURE */
Expand Down
1 change: 1 addition & 0 deletions DataDiggerLib32.p
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{DataDiggerLib.p &PROC-ARCH=32}.
1 change: 1 addition & 0 deletions DataDiggerLib64.p
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{DataDiggerLib.p &PROC-ARCH=64}.
2 changes: 2 additions & 0 deletions getProcessArchitecture.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DEFINE OUTPUT PARAMETER iProcessArchitecture AS INTEGER NO-UNDO.
iProcessArchitecture = PROCESS-ARCHITECTURE.
18 changes: 17 additions & 1 deletion startDiggerLib.p
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

DEFINE VARIABLE hDiggerLib AS HANDLE NO-UNDO.
DEFINE VARIABLE hCustomLib AS HANDLE NO-UNDO.
DEFINE VARIABLE iProcArch AS INTEGER NO-UNDO.

/* Call out to see if the libraries have been started
*/
Expand All @@ -16,7 +17,22 @@ IF NOT VALID-HANDLE(hDiggerLib) THEN
DO:
/* Start main library
*/
RUN DataDiggerLib.p PERSISTENT SET hDiggerLib.
DO ON ERROR UNDO, LEAVE
ON STOP UNDO, LEAVE:
/* this file won't compile and won't run on version < 11.3,
only 11.3 and higher can be 64 bit
this will give an error or stop condition on versions under 11.3
catch this error and assume 32 bit as the first 64 bit client is 11.3
*/
IF SEARCH("getProcessArchitecture.r") <> ?
THEN RUN 'getProcessArchitecture'(OUTPUT iProcArch) NO-ERROR.
END.
/* progress r-files are not bit dependent,
however calls to the Windows API require other variable types
select the correct veriabled types by starting the correct file */
IF iProcArch = 64
THEN RUN DataDiggerLib64.p PERSISTENT SET hDiggerLib.
ELSE RUN DataDiggerLib32.p PERSISTENT SET hDiggerLib.
SESSION:ADD-SUPER-PROCEDURE(hDiggerLib,SEARCH-TARGET).

/* Populate the ttConfig table. Must only be done when the lib is started
Expand Down