diff --git a/DataDigger2.p b/DataDigger2.p index ea0de4f..48d82ba 100644 --- a/DataDigger2.p +++ b/DataDigger2.p @@ -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. diff --git a/DataDiggerLib.p b/DataDiggerLib.p index 37c8039..55a60fe 100644 --- a/DataDiggerLib.p +++ b/DataDiggerLib.p @@ -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 */ diff --git a/DataDiggerLib32.p b/DataDiggerLib32.p new file mode 100644 index 0000000..7aa44a8 --- /dev/null +++ b/DataDiggerLib32.p @@ -0,0 +1 @@ +{DataDiggerLib.p &PROC-ARCH=32}. diff --git a/DataDiggerLib64.p b/DataDiggerLib64.p new file mode 100644 index 0000000..9665670 --- /dev/null +++ b/DataDiggerLib64.p @@ -0,0 +1 @@ +{DataDiggerLib.p &PROC-ARCH=64}. diff --git a/getProcessArchitecture.p b/getProcessArchitecture.p new file mode 100644 index 0000000..71fc01f --- /dev/null +++ b/getProcessArchitecture.p @@ -0,0 +1,2 @@ +DEFINE OUTPUT PARAMETER iProcessArchitecture AS INTEGER NO-UNDO. +iProcessArchitecture = PROCESS-ARCHITECTURE. diff --git a/startDiggerLib.p b/startDiggerLib.p index 332ad7e..cf674bd 100644 --- a/startDiggerLib.p +++ b/startDiggerLib.p @@ -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 */ @@ -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