From: Ashley W. <ash...@nt...> - 2001-12-21 19:24:22
|
Hi... I wonder if someone could help me. I maintain our research group's software, which is written mainly in C (about 40k LOC) and makes use of Tcl and Tk. The source is generically called Eden, but there are three possible targets, named ttyeden (command-line interaction), tkeden (interaction through a GUI built with Tk) and dtkeden (as tkeden but with distributed communication/computation features). Eden was originally developed on SunOS, then Solaris... and now it has been ported to Linux and Windows (using cygwin). I rewrote the original iMake based stuff using autoconf to assist with this. I tried a while back to port it to Mac OS 9 using CodeWarrior, but it all proved a little tricky. Now I have Mac OS X, I'm trying again. I've happily built ttyeden using my familiar autoconf-generated configure script and Makefiles in Terminal.app. I'd prefer to use this setup (as I do on Windows with cygwin) rather than Project Builder as I hope it would then be easier to maintain this software across the several platforms. Last night I managed to build tkeden using Jim Ingham's native Tk port (I'd like to use this as opposed to using an X server, as I'd like to see the interface use Aqua buttons and so on). I installed the binaries from MacOSXTk8.4a4.tar.gz, and have a working Wish.app. I can compile and link tkeden... I spent a while last night figuring out that the trick here was to link explicitly with /Library/Frameworks/Tcl.framework/Tcl and /Library/Frameworks/Tk.framework/Tk (-L..., -lTk etc doesn't seem to work). When I run my application, I now get a partially-drawn interface window, but then it hangs. I can use gdb to generate a backtrace: ^C Program received signal SIGINT, Interrupt. 0x7003f4c8 in semaphore_wait_signal_trap () (gdb) bt #0 0x7003f4c8 in semaphore_wait_signal_trap () #1 0x7003f2c8 in _pthread_cond_wait () #2 0x00436820 in Tcl_ConditionWait () #3 0x004370cc in Tcl_WaitForEvent () #4 0x00417ac4 in Tcl_DoOneEvent () #5 0x0087af2c in Tk_MainLoop () at ../generic/tkEvent.c:1257 #6 0x0000482c in main (argc=3, argv=0xbffff9b0) at main.c:1594 #7 0x000022bc in _start () #8 0x000020ec in start () My application has happily done all its initialisation code and set up a Tcl_DoWhenIdle call back, which enables the app to get on with processing its run queue when the interface is in a sensible state. The Tk_MainLoop call shown above is pretty much the last thing done in main(). I suspect that perhaps I'm getting the Tcl/Tk initialisation wrong. I've had a look at tkMacOSXAppInit.c from the macosx-8-4-branch on CVS and have copied a few likely-looking things into my Tcl_AppInit() and main(). In particular, I've added TkMacOSXInitAppleEvents(interp); and TkMacOSXInitMenus(interp); to Tcl_AppInit() (which doesn't seem to have any effect) and tried adding Tk_MacOSXSetupTkNotifier(); to main(), which then causes a similar but deeper hang earlier on (not in the call to Tk_MacOSXSetupTkNotifier()). The initialisation code as it stands works on Solaris, Linux and cygwin. I don't admit to understanding it fully though. Can anyone give me any hints, before I go to the next nasty stage of reducing the code to a test case? Is there any documentation I should read in particular... I can't find any docs for TkMacOSXInitAppleEvents etc. This is my first real attempt at programming on the Mac, but I have experience on UNIX. I've just done Software Update to Mac OS X 10.1.2 but I don't have quite the most recent Developer Tools yet -- I have Project Builder 1.1 (v73.3), cc version 2.95.2 if that helps. I'm using a new "white" iBook, 600MHz. The Eden source is up at <http://sf.net/projects/eden/>. Our research home page is <http://www.dcs.warwick.ac.uk/modelling/>. Many thanks for any help. Ash. -- Ashley Ward - Graduate Teaching Assistant - PhD student as...@dc... - http://www.dcs.warwick.ac.uk/~ashley/ Room 3.16, Department of Computer Science, University of Warwick, Coventry |