Call C++ from Cobol

Hello Experts,

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.cpp --- Compile C++ sub program
3.) $ cp /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


CALL from main. --- Message produced in main program right before the call
libcob: Cannot find module 'SUBC' --- Error message says C++ program not found

Hi there,

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.

Sorry I couldn't be of more help.

All the best,
Thankyou for the response NwN,

I will move it into the general 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.

hey JackG, I do not how COBOL works, but you can verify if your program has been linked through ldd (.exe?) CALLSHA
Topic archived. No new replies allowed.