Highlighted
Absent Member.
Absent Member.
439 views

[archive] Solaris shared objects and STL

[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.
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Solaris shared objects and STL

Did you use this runtime configuration variable:

SHARED_LIBRARY_LIST
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.