|File Search||Catalog||Content Search|
swig… more info»
This example shows how you can make a dynamically loadable C++ module for Tcl. There are a number of things you need to know : 1. Don't use static constructors. 2. You may need to edit the file Makefile.template to get the right library files In order to build a C++ module, it's necessary to do some funny tricks with the linker. For g++, running under Solaris, the compile process looks like this : c++ -c shapes_wrap.c -I/usr/local/include ld -G shapes_wrap.o -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \ -L/usr/local/lib -lg++ -lstdc++ -lgcc -o Shapes.so ^^^^ This is critical! To run the example, just type 'tclsh7.5 shapes.tcl'. If you get some output and no error messages, then you've done it right. Good luck!