From: cxh AT eecs DOT berkeley DOT edu (Christopher Hylands) Subject: Tcl/Tk MSVC++ dlls and g++ 20 Mar 1997 11:48:36 -0800 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199703201710.JAA22005.cygnus.gnu-win32@kahn.eecs.berkeley.edu> Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com I'm a MSVC++ newbie, so this might be a silly question, but here goes. I'm trying to compile Ptolemy, a package that uses g++, but I need to link with Tcl/Tk and Itcl. The Tcl/Tk and Itcl C dlls made with the MSVC++ compiler. I'm trying my compile under VC++4.0 under NT4 with the 17.1b tools. When I first tried to link with the Tcl and Itcl libraries with: g++ -L../../lib.nt4 -Wl,-s ptclAppInit.o version.o -lptcl -lexttools \ -lptmatlab -lptmathematica -lptolemy c:/Itcl2.2/itcl/win/Itcl22.lib \ c:/Itcl2.2/tcl7.6/win/Tcl76i.lib -lg++ -lm -o ptcl.ptiny I got messages like: c:/Itcl2.2/tcl7.6/win/Tcl76i.lib(Tcl76i.dll)(.idata$2+0x0): multiple definition of `idata$2' c:/Itcl2.2/itcl/win/Itcl22.lib(Itcl22.dll)(.idata$2+0x0): first defined here c:/Itcl2.2/tcl7.6/win/Tcl76i.lib(Tcl76i.dll)(.idata$2+0x0): multiple definition of `idata$4' c:/Itcl2.2/itcl/win/Itcl22.lib(Itcl22.dll)(.idata$2+0x0): first defined here c:/Itcl2.2/tcl7.6/win/Tcl76i.lib(Tcl76i.dll)(.idata$2+0x0): multiple definition of `idata$5' c:/Itcl2.2/itcl/win/Itcl22.lib(Itcl22.dll)(.idata$2+0x0): first defined here C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32/cygnus-2.7.2-961023/libgcc.a I created a library called TclItcl.dll by combining the tcl and itcl ..obj files and then linked with: g++ -L../../lib.nt4 -Wl,-s ptclAppInit.o version.o -lptcl -lexttools \ -lptmatlab -lptmathematica -lptolemy c:/Itcl2.2/itcl/win/TclITcl.lib \ -lm -o ptcl.ptiny This worked, a binary was produced, but when I started it up, I got he message: "The procedure entry point could not be located in the dynamic link library TclITcl.dll" Has anyone had any success combining Tcl/Tk and g++? Can anyone send me either a g++ link line or a makefile.vc that does the trick? http://www.cygnus.com/misc/gnu-win32/faq.html says Can I mix objects compiled with msvc++ and gcc? Yes, this supposedly works. The key seems to be using MS's LINK.EXE to do the linking instead of GNU ld. There may be issues with constructor calls for C++/Obj C. The problem here is that tcl/tk is compiled using MS visual c++, and we need to have g++ set things up for our constructors. It could be that there is a bug in how I built the shared library, but it looks ok See http://ptolemy.eecs.berkeley.edu for information about Ptolemy See http://ptolemy.eecs.berkeley.edu/nt-ptolemy for more info about my efforts to compile Ptolemy -Christopher - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".