Example code for beginers in writting extensions... [tBuild package]
From: Georgios Petasis (petasis_at_iit.demokritos.gr)
Date: 11/28/03
- Next message: Gustaf Neumann: "Re: A itcl question for variable"
- Previous message: Xibin: "PCIGPIB CARD IN GENPLOT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 28 Nov 2003 23:27:09 +0200
Hi all,
I have done a small update in the tBuild package and I have
also added a release at SF:
https://sourceforge.net/project/showfiles.php?group_id=41786&release_id=2005
59
What is tBuild? Its a small tcl-only extension that can be
used (hopefully) to easily compile and link (simple :-)) tcl
extensions. It requires VC++ under windows
and what ever compiled tcl under unix.
(Under unix the tclConfig.h and perhaps tkConfig.h
must be installed in order for tBuild to work).
However, the most interesting addition is a small
package that can be used to generate a small
tcl extension. I wrote it in the process of
testing tBuild. There is also a small
test script, that generates such an extension.
Along with the extension, a tcl script for
building the extension is automatically created.
Creating an empty tcl extension (that does
nothing but it can be compiled and loaded in
Tcl) is quite easy:
package require tBuild::Extension
::tBuild::tExtension::CreateTclExtension \
-pkgName testExtension \
-pkgDir [pwd] \
-cmdSpec {tBuildTest Test}
Studying this sample extension can be a good
exercise for those who want to develop their
first extension :-)
Compiling the extension is as easy as:
set OBJS [::tBuild::CompileSharedObject -define BUILD_%pkgNameUpper% \
-includedir generic \
generic/tcl%pkgName%.c \
generic/%pkgName%.c]
eval ::tBuild::LinkSharedLibrary \
-output lib/$binDir/lib%pkgName%[info \
sharedlibextension] $OBJS
(Of course the compilation script is automatically
generated during the extension creation.)
I hope some of you will find it usefull...
George
- Next message: Gustaf Neumann: "Re: A itcl question for variable"
- Previous message: Xibin: "PCIGPIB CARD IN GENPLOT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|