I am trying to call a C++ program from a Cobol program. I have searched all over for 3.5 weeks, and this is driving me crazy. I am running CYGWIN on a windows 7 machine. My UNIX is very novice.
My c++ program computes a sha256 hash algorithm. I know it works, as i have successfully called it from another C++ program, and verified the results.
My problem is that when I try to dynamically link the main cobol program with the C++ sub program, everything looks fine on the surface. But when I execute the main program, and it calls the C++ program, I get the message displayed on the console: libcob: Cannot find module 'SUBC'.
Here are the steps I followed to compile the main program and link it with the C++ subprogram, as per OpenCobol
1.) $ cobc -x CALLSHA.cbl --- Compile the calling program
2.) $ g++ -shared -o SUBC.so SUBC.cpp --- Compile C++ sub program
3.) $ cp SUBC.so /Lib --- install the module in library directory
4.) $ export COB_LIBRARY_PATH=/Lib ---
5.) $ ./CALLSHA --- Run main program which is dynamically linked with C++ module
HERE IS THE OUTPUT FROM THE RUN:
CALL from main. --- Message produced in main program right before the call
libcob: Cannot find module 'SUBC' --- Error message says C++ program not found
This isn't exactly beginner's stuff (beginners in the context of being new to the c++ language).
You will have better chances of getting your question answered in the "general C++ programming" forum.
Hope somebody knows how to compile and link. Main module is Cobol, subprogram is C++.
All I want is for the program to be found when the call is made. I will take care of anything else. I think this is probably basic stuff, but I dont know unix, and have been stuck almost a month on this problem, which is why I finally came to this forum.