[Migrated content. Thread originally posted on 03 March 2008]
We are trying to interface with a shared library on solaris, however as soon as we call a program that references the STL the program fails with a "Not a COBOL program" error.The following simple program:
#include <stdio.h>
#include <string>
using namespace std;
extern "C" int testFunc(void);
int testFunc(void) {
string mystring = "blah";
printf("Test function!\\n");
return 0;
}
Generates the following log:
Configuration file = '/etc/cblconfig'
/etc/cblconfig: No such file or directory
Try loading 'TESTSO.gnt'...
TESTSO.gnt loaded
Try loading 'testso.so'...
open library: testso.so
could not open testso.so
ld.so.1: runcbl: fatal: /opt/acu/lib/testso.so: open failed: No such file or directory
testso.so: Not a COBOL program
COBOL error at 000009 in TESTSO.gnt
As soon as I comment out the string reference in the C program the problem goes away.
I am compiling and linking the so as follows:
CC -c -g testso.cpp
CC -G -o testso.so testso.o
We can run the exact same code as a DLL on windows without any issues.
Any help / advice would be greatly appreciated.
Andy.



