I am trying to perform a CALL subroutine but am getting an error "libcob: error: module 'hello' not found" from the following simple test set. It consists of program hellowcall, sub-program hello & invoking batch file testcall.cmd. The result I am trying to get is to display "hello(w) world!" & "from subroutine -- hello world!", the first from the mainline & second from the called routine and expected the PATH environment variable to allow me to do this as long s it included the libraries of both main & sub-routine regardless of where they are. (I wish to be able to separate my Cobol from the gnuCOBOL locations, to be able to use development & production libraries for both main & sub-routines & to use dynamic calling.)
hellowcall compiled as main program to hellowcall.exe:
id division.
program-id. hellowcall.
procedure division.
display 'hello(w) world!'.
call 'hello'.
hello compiled as subprogram to hello.dll:
id division.
program-id. hello.
procedure division.
display 'from subroutine -- hello world!'.
Testcall.cmd in c:\COBOL & run from there using cmd: @echo off
rem test calling of hello.dll from hellowdevl.exe
:: set PATH=c:\testlib1;c:\testlib2;%PATH%
:: set PATH=c:\testlib2;%PATH%
echo %PATH%
hellowcall
pause
CASE 1:
If hellowcall.exe & hello.dll are both in testlib2 then:
running testcall with all set PATH commented out gives "''hellowcall' is not recognized as an internal or external command, operable program or batch file."
running with only set PATH=c:\testlib2;%PATH% not commented out gives "hello(w) world!" & "libcob: error: module 'hello' not found"
running with only set PATH=c:\testlib1;c:\testlib2;%PATH% not commented out gives the same as ...testlib2...
CASE 2:
If hellowcall.exe is in testlib2 & hello.dll in testlib1 gives the same results as above in all cases.
CASE 3:
Adding cd c:\testlib2 at the begining of testcall.cmd then:
If hellowcall.exe is in testlib2 & hello.dll in testlib1
running testcall with all set PATH commented out gives gives "hello(w) world!" & "libcob: error: module 'hello' not found"
other PATH settings also fail
Only if hellowcall.exe & hello.dll are both in testlib2 and having added cd c:\testlib2 does:
running testcall with all set PATH commented out gives "hello(w) world!" & "from subroutine -- hello world!"
--- the expected result
any other PATH settings have no effect giving the same expected result.
It appears that the PATH variable enables finding the mainline but not the .dll (I tried adding .dll to the PATHEXT variable with no effect).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to perform a CALL subroutine but am getting an error "libcob: error: module 'hello' not found" from the following simple test set. It consists of program hellowcall, sub-program hello & invoking batch file testcall.cmd. The result I am trying to get is to display "hello(w) world!" & "from subroutine -- hello world!", the first from the mainline & second from the called routine and expected the PATH environment variable to allow me to do this as long s it included the libraries of both main & sub-routine regardless of where they are. (I wish to be able to separate my Cobol from the gnuCOBOL locations, to be able to use development & production libraries for both main & sub-routines & to use dynamic calling.)
hellowcall compiled as main program to hellowcall.exe:
id division.
program-id. hellowcall.
procedure division.
display 'hello(w) world!'.
call 'hello'.
hello compiled as subprogram to hello.dll:
id division.
program-id. hello.
procedure division.
display 'from subroutine -- hello world!'.
Testcall.cmd in c:\COBOL & run from there using cmd:
@echo off
rem test calling of hello.dll from hellowdevl.exe
:: set PATH=c:\testlib1;c:\testlib2;%PATH%
:: set PATH=c:\testlib2;%PATH%
echo %PATH%
hellowcall
pause
CASE 1:
If hellowcall.exe & hello.dll are both in testlib2 then:
running testcall with all set PATH commented out gives "''hellowcall' is not recognized as an internal or external command, operable program or batch file."
running with only set PATH=c:\testlib2;%PATH% not commented out gives "hello(w) world!" & "libcob: error: module 'hello' not found"
running with only set PATH=c:\testlib1;c:\testlib2;%PATH% not commented out gives the same as ...testlib2...
CASE 2:
If hellowcall.exe is in testlib2 & hello.dll in testlib1 gives the same results as above in all cases.
CASE 3:
Adding cd c:\testlib2 at the begining of testcall.cmd then:
If hellowcall.exe is in testlib2 & hello.dll in testlib1
running testcall with all set PATH commented out gives gives "hello(w) world!" & "libcob: error: module 'hello' not found"
other PATH settings also fail
Only if hellowcall.exe & hello.dll are both in testlib2 and having added cd c:\testlib2 does:
running testcall with all set PATH commented out gives "hello(w) world!" & "from subroutine -- hello world!"
--- the expected result
any other PATH settings have no effect giving the same expected result.
It appears that the PATH variable enables finding the mainline but not the .dll (I tried adding .dll to the PATHEXT variable with no effect).