I have been trying to call a C++ dll in a cobol program but the after the build which is sucessful the dll is not loaded and the functions within the dll are not being accessed. Can anyone help Please...
i am using fujitsu cobol, which is net cobol but not .net cobol.
No error messages but can't find the function in the dll. The dll is written in C++ with 'extern c' and the platform is windows 2000 professional.
i have used the following code to
* TEST TO CALL AUDIT PROGRAM
MOVE "AUDIT5" TO PROGRAM-TO-CALL
MOVE "STARTPROCESS" TO FUNCTION-TO-CALL
MOVE "GNSSTART" & X"00" TO SCRIPT-NAME
MOVE "LAWTEST" & X"00" TO PROCESS-NAME
MOVE "1.0" & X"00" TO VERSION
MOVE "GNS0101" & X"00" TO CYCLE-NAME
CALL PROGRAM-TO-CALL
ON EXCEPTION DISPLAY "CALL TO AUDIT PROGRAM FAILED"
NOT ON EXCEPTION DISPLAY "CALL TO AUDIT PROGRAM SUCCESSFUL"
END-CALL
CALL FUNCTION-TO-CALL
USING BY CONTENT SCRIPT-NAME
BY CONTENT PROCESS-NAME
BY CONTENT VERSION
BY CONTENT CYCLE-NAME
ON EXCEPTION DISPLAY "CALL TO AUDIT FUNCTION FAILED"
NOT ON EXCEPTION DISPLAY "CALL TO AUDIT FUNCTION SUCCESSFUL"
END-CALL
Try static linking by not putting the function name in a variable:
- If PROGRAM-TO-CALL ("AUDIT5" is meant for loading the dll, delete the entire statement, it is not necessary when static linking is used.
- Delete the two cancel statements.
- Delete the FUNCTION-TO-CALL variable and change the call-styatement to call it direct, CALL "STARTPROCESS" USING ...
When linking the program, include <dllname>.lib, which will be generated when compiling the dll.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.