Re: makefile for compiling ready-made tcl callable C source
From: Arjen Markus (arjen.markus_at_wldelft.nl)
Date: 03/26/04
- Previous message: Jeff Hobbs: "Re: What is the values returned by tktable bbox?"
- In reply to: John Douglas: "makefile for compiling ready-made tcl callable C source"
- Next in thread: Benjamin Riefenstahl: "Re: makefile for compiling ready-made tcl callable C source"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Mar 2004 08:48:11 +0100
John Douglas wrote:
>
> Can somebody direct me to a clear and simple 'barebones' example of how to
> compile C code so its callable from tcl/tk? Preferably a makefile for
> Borland on Windows. (I've combed through the wiki, SWIG, and archives of
> this newsgroup and I've learned a lot about how to prepare and/or generate
> the C source code to do this; but little is written on the compilation
> part.) I have not been able to translate the various Makefiles into one
> for use with Borland.
>
> Additionally, is it perhaps possible to do this with an older compiler that
> is Dos based rather than windows based?
>
> Thanks,
> Doug
Have you had a look at TEA (Tcl Extension Architecture)?
It is explained in detail in Brent Welch's book (at least from the third
edition
onwards).
If you are merely targetting a single platform (the Borland C compiler
on Windows),
then why not do the following:
- Define a project (AFAIU, Borland C comes with one of those IDEs - I am
not overly
fond of them in general and I will not comment on some of their
properties as this
is a very polite newsgroup - but they can be useful at times) that
will build
a DLL from your source code.
- Add the following options:
- The path to your Tcl include files
- The macro USE_TCL_STUBS (if you use stubs, which I can recommend
heartily!)
- The path to your Tcl libraries (especially the stubs library) in the
linkstep
With this you should be able to get it a-going.
(For my Tcl-Fortran combination - Fortran programs calling Tcl
procedures -
I have used a simple makefile like:
TCL_INCLUDE = ...../markus/tcl/include
TCL_LIB = ...../markus/tcl/lib
calc : calc.o ftcl_c.o ftcl_mod.o
f90 -o calc calc.o ftcl_c.o ftcl_mod.o -L$(TCL_LIB) -ltcl8.3
ftcl_mod.o : ftcl_mod.f90
f90 -c ftcl_mod.f90
calc.o : calc.f90 ftcl_mod.o
f90 -c calc.f90
ftcl_c.o : ftcl_c.c ftcl.h
cc -c ftcl_c.c -I$(TCL_INCLUDE)
But that of course works the other way around ... and on Linux ...
and does not do stubs. Oh and it is an old example, viz. 8.3 instead of
8.4)
Regards,
Arjen
- Previous message: Jeff Hobbs: "Re: What is the values returned by tktable bbox?"
- In reply to: John Douglas: "makefile for compiling ready-made tcl callable C source"
- Next in thread: Benjamin Riefenstahl: "Re: makefile for compiling ready-made tcl callable C source"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|