Pseudo-Incremental Linking for C/C++ 
by William A. Hoffman and Rupert W. Curwen


Example 1: 

#include "classtest.h"
extern "C" int classtest()
{
   ClassTest c;
   c.test1();
   c.test2();
   return 1;
}

Example 2:

(gdb) set auto-so-lib 0
(gdb) b main
Breakpoint 1 at 0x17588: file main.cc, line 5.
(gdb) run
Starting program: /home/form/toplevel/bin/sun4-solaris/toplevel 
unlimited
warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.
 
Breakpoint 1, main () at junk.cc:5
5         cout << "Starting toplevel..." << endl;
(gdb) shared Numerics
Reading symbols from 
            home/form/toplevel/lib/sun4-solaris/libNumerics.so.1...done.
done.
(gdb) break EigenSystem::Get
Breakpoint 2 at 0x5c220: file EigenSystem.cc, line 450.
(gdb) cont
  ...




Example 3: 

all: vtkrun Cone Hanoi
DLoadLib.o : DLoadLib.C DLoadLib.h
	c++ -c DLoadLib.C
tjrun.o : tjrun.C
	c++ -c tjrun.C
vtkrun: tjrun.o DLoadLib.o
	c++ -o vtkrun tjrun.o DLoadLib.o -ldl -L/home/martink/Mesa-3.0/lib -L/home/martink/vtk/lib -lVTKCommon -lVTKContrib -lVTKGraphics -lVTKImaging  -lMesaGL -lX11 -lXt -L/usr/X11R6/lib -lpthread -lXext
VTK_FLAGS = -I${VTK_HOME}/graphics -I${VTK_HOME}/imaging -I${VTK_HOME}/contrib -I${VTK_HOME}/common -Iexamples
Cone : examples/Cone.cxx
	c++ ${VTK_FLAGS} -shared -o Cone examples/Cone.cxx
Hanoi : examples/Hanoi.cxx
	c++ ${VTK_FLAGS} -shared -o Hanoi examples/Hanoi.cxx
# to run framework examples:
# ./vtkrun Cone
 .# /vtkrun Hanoi




Listing One
// -----------------------------------------------------------------------
//                   Copyright (c) 1997 TargetJr Consortium
//               GE Corporate Research and Development (GE CRD)
//                             1 Research Circle
//                            Niskayuna, NY 12309
//                            All Rights Reserved
//              Reproduction rights limited as described below.
// Permission to use, copy, modify, distribute, and sell this software
// and its documentation for any purpose is hereby granted without fee,
// provided that (i) the above copyright notice and this permission
// notice appear in all copies of the software and related documentation,
// (ii) the name TargetJr Consortium (represented by GE CRD), may not be
// used in any advertising or publicity relating to the software without
// the specific, prior written permission of GE CRD, and (iii) any
// modifications are clearly marked and summarized in a change history log.
// THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
// IN NO EVENT SHALL THE TARGETJR CONSORTIUM BE LIABLE FOR ANY SPECIAL,
// INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND OR ANY
// DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
// WHETHER OR NOT ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR ON
// ANY THEORY OF LIABILITY ARISING OUT OF OR IN CONNECTION WITH THE
// USE OR PERFORMANCE OF THIS SOFTWARE.
// ------------------------------------------------------------------------
// Module: TestDriver.C
// Purpose: Generic test driver program to be copied to test 
//   directories by generic.mk
#include "RunDynamicTests.h"
#include <iostream.h>

main(int argc, char** argv)
{
  if(argc < 2)
    {
      cerr << "Usage: " << argv[0] << " fullpath/to/testlibrary " << endl;
      return -1;
    }
  cout << endl
       << "BEGIN: Generic TargetJr TestDriver: Testing - " 
       << argv[1] << endl;
  return RunDynamicTests::RunTests(argc, argv);
}






3


