Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

libclntsh.sl , is it a pure "C" library or C++ library?

Srinivasa_4
Occasional Contributor

libclntsh.sl , is it a pure "C" library or C++ library?

Hi
I would like to know whether the following are pure C libraries or "C++" libraries?
libclntsh.sl.9.0
libjava.sl
libwtc9.sl

Thanks
Srinivasa
4 REPLIES
Stephen Keane
Honored Contributor

Re: libclntsh.sl , is it a pure "C" library or C++ library?

A quick check would be to do an nm on them. If they are C++ libraries then the function names will probably be mangled, if they are mangled then it is definitely a C++ library. If they aren't mangled, it could still be a C++ library (specially compiled) or more likely a C library.

If you are not sure, post the result of nm on each of them and we can take a look for you.

libclntsh.sl.9.0, libjava.sl
and libwtc9.sl
are C++ libraries, I believe.




Srinivasa_4
Occasional Contributor

Re: libclntsh.sl , is it a pure "C" library or C++ library?

Steve, Thanks a lot for the quick response.

I did "nm" on the files, but it does not show any symbols. (Probably they are stripped). But the symbols are displayed when I did "nm" on solaris libraries.
I have attached the output of nm on libclntsh.so.9.0

I also looked for files using
nm libclntsh.so.9.0 |grep FILE
This listed only .c files. Does it mean that it is a pure "c" library?

Thanks
Srinivasa
Eric Antunes
Honored Contributor

Re: libclntsh.sl , is it a pure "C" library or C++ library?

Hi Srinivasa,

I think they are Pro*C/C++ libraries (See Pro*C/C++ Precompiler Release 8.0 Programmer's Guide).

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Alexey Roytman
Frequent Advisor

Re: libclntsh.sl , is it a pure "C" library or C++ library?

Generally, a pure C library differs from C++ library by 2 things:
1. C++ one may be linker to C++ runtime library (libCrun);
2. startup code (init/fini) symbols on library loading/unloading are defined.

I've cheched libclntsh.sl for being C or C++, and can not tell you about it anything. There are pros and contras:

1. no mangled names -- maybe, all C++ symbols are remapped at linking, or [extern "C"] used
2. there are init/fini functions in there, but I can not find the INIT/FINI attribute for them

Thus, if you want to load it dynamically, I recommend to do:

shl_load(libraryName,BIND_DEFERRED|BIND_VERBOSE|BIND_TOGETHER,0L);