[Rd] Including C Code for Tcl and Tk in an R package
Adrian Waddell
ml_a at waddell.ch
Mon Aug 30 08:01:18 CEST 2010
Dear R Community,
I adapted the C-Code found at (http://wiki.tcl.tk/25685) implementing
fast image resizing for Tk images for my R package.
The C Code differs for tcl/tk version 8.4 and 8.5. I have the working
code for both versions.
How do I integrate this C-Code into my package so that R CMD INSTALL
takes care of compiling the function correct for each OS and tcl
version? (such that I can submit the package to CRAN).
Once the two files would be compiled I could load the correct function
by checking with
> library(tcltk)
> .Tcl('set tcl_version')
which tcl version R connects to?
For example the gcc command I call under Ubuntu is:
gcc -shared -o imgscale.so -DUSE_TCL_STUBS -I/usr/include/tcl8.5/
imagescale_85.c -L/usr/lib/ -ltclstub8.5 -fPIC
and
gcc -shared -o imgscale.so -DUSE_TCL_STUBS -I/usr/include/tcl8.4/
imagescale_84.c -L/usr/lib/ -ltclstub8.4 -fPIC
Thanks,
Adrian Waddell
More information about the R-devel
mailing list