Displaying 2 results from an estimated 2 matches for "duse_tcl_stub".
Did you mean:
duse_tcl_stubs
2010 Aug 30
1
Including C Code for Tcl and Tk in an R package
...hat 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
2011 Feb 08
1
Compiling a Tcl extension for an R package
...jResult(interp, Tcl_NewStringObj("Hello, World!", -1));
return TCL_OK;
}
int DLLEXPORT Hello_Init(Tcl_Interp *interp) {
Tcl_CreateObjCommand(interp, "hello", Hello_Cmd, NULL, NULL);
return TCL_OK;
}
which can be compiled (under Ubuntu 10.04) with:
gcc -shared -o hello.so -DUSE_TCL_STUBS -I/usr/include/tcl8.5/ hello.c
-L/usr/lib/ -ltclstub8.5 -fPIC
and used within an R session with
library(tcltk)
.Tcl('load ./hello[info sharedlibextension]')
tcl('hello')