Any help would be appreciated?
A good example of how to create a shared library which makes calls to a
c++ library would be useful.
P.S. I have mainly been trying to compile this using the aCC compiler.
> I have a very complicated problem relating to the creation of shared
> libraries on HP 10.20. I am trying to create a shared library and have
> it loadable by TCL. From within my shared library I have references to
> third party shared libraries that are wrote in c++.
> I am able to build the my shared library but TCL fails to load it.
> I modified the TCL source and recompiled it so it would spit out what is
> going on when it tries to load my shared library. It fails on the
> symbol __shlinit which can be found in the libCsup.sl file. So I tried
> to link in that file and then I get the symbol __staticCtortable_Start
> (data) as unresolved.
Tcl's load command is not compatible with C++ shared libraries that
construct and destruct C++ objects. You'll need to use the un-documented
function cxxshl_load, in place of the shl_load command. Check out the
online help for CC using the +help option. There's a brief mention of this
Hope this helps !
David Woodbury IT CIM Solutions
Email: mailto:r28...@email.sps.mot.com Motorola SPS
voice: 602-914-8194 426 North 44 Street
fax: 602-914-8130 Gateway 1, Suite 250
pager: 888-782-2096 Phoenix, AZ 85008
> Frank Pilhofer <f...@informatik.uni-frankfurt.de> wrote:
> > And there's no need to. There is only one problem where compiling Tcl
> > with a C++ compiler has an effect, and that's HP-UX, where loadable C++
> > modules simply don't work if main() is not compiled with aCC.
> We found that it *is* possible to load C++ extensions on HP-UX though we
> don't have aCC.
> The most important secret you've to know about is the
> function which is a sibling of shl_load(), organizing correct
> initializations of C++ instances. In short, you've to patch
> the tclLoadShl.c module:
> (1) #include <cxxdl.h>
> ... then shl_t cxxshl_load(const char *path, int flags,
> long address);
> is declared.
> (2) Replace the shl_load()
> - handle = shl_load(fileName, BIND_IMMEDIATE, 0L);
> + handle = cxxshl_load(fileName, BIND_IMMEDIATE, 0L);
> (or even *much* better:)
> + handle = cxxshl_load(fileName, BIND_IMMEDIATE|BIND_VERBOSE, 0L);
> Note: the shlcxx_load function is in /opt/CC/libC.1 which is
> automagically linked into C++ executables.
> If tclLoadShl.c is *not* patched, I don't see any chance to load
> explicitly a C++ extension into a native tclsh executable.
> With HP specific patches (see above), you may compile Tcl's main()
> with cc. When linking you should add the following flags
> -E -L/opt/CC/lib -lC -lcxx
> The -E is to "Mark all symbols defined by a program for export
> to shared libraries."
> PS: I learned most of that from Martin Hofmann (u...@daveg.com) who did
> the research on the issue.
> Ulrich Ring, Daveg GmbH Darmstadt (Germany) - u...@daveg.com
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Scott - is this going into the Tcl 8.1.1 porting file?
<URL: mailto:lvi...@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.