Subject: Re: Only for the true TCL die hard. - DN [1]


Scott Redman <redman@scriptics.com> - 20 May 1999 - comp.lang.tcl

 To save everyone from searching....I kept the
 message locally, here is a copy of how to fix
 the C++ loading on HP:

 -- Scott

 uring@my-dejanews.com wrote:
 >
 > Frank Pilhofer <fp@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
 >
 >     cxxshl_load()
 >
 > 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."
 >
 > --Ulrich
 >
 > PS: I learned most of that from Martin Hofmann (ur@daveg.com) who did
 > the research on the issue.
 >
 > Ulrich Ring, Daveg GmbH Darmstadt (Germany) - ur@daveg.com
 >
 > -----------== Posted via Deja News, The Discussion Network ==----------
 > http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated