[Rd] Compiling Tcl extension C Code for an R package

Adrian Waddell adrian at waddell.ch
Mon Nov 8 16:41:13 CET 2010


Dear R Community,

I'm working on an R package that needs resizing of images. I try to keep
dependencies of Tcl packages as little as possible, so I implemented the
Image Scaling procedure in C as a Tcl extension found here
http://wiki.tcl.tk/25685 .

Here a temporary download link of the slightly modified source

http://www.waddell.ch/RnavGraph/imagescale_adrian_85.c

The file works with the Tcl version 8.5. I've added the gcc compile
commands I use for Linux, OSX and Windows (minGW) at the beginning of
the file.

I'm  struggling to dynamically load the extension under Windows 7. That
is i tried to use

load imgscale.dll

where under Linux and OSX I use

load ./imgscale[info sharedlibextension]

Now my Questions: does anybody know how to deal with this C extension
such that when I distribute the R-package over CRAN it will work on
every OS? This includes the question why I can not load the extension in
Windows. Is there an R package out there which uses a C extension for a
Tcl function from which I could learn how to do this?

Thanks,

Adrian



More information about the R-devel mailing list