Creating library for TCL
(1) By Holger Jakobs (holgerjakobs) on 2020-12-02 13:51:40 [link] [source]
The description about using -DPIKCHR_TCL in order to create a library for TCL could be accomanied by an entry in Makefile:
piktcl: pikchr.c
$(CC) -shared -o libpikchr.so $(CFLAGS) -DPIKCHR_TCL -I /usr/include/tcl8.6 pikchr.c -lm -L /usr/lib/x86_64-linux-gnu/ -ltcl8.6
This one works on Ubuntu 20.04
The created library can be loaded via the load command, but creating a pkgIndex.tcl file and using package require doesn't work.
The error is:
attempt to provide package pikchr 1.0 failed: no version of package pikchr provided
while evaluating package require pikchr 1.0
I had created a pkgIndex.tcl file with this entry:
package ifneeded pikchr 1.0 [list load [file join $dir libpikchr.so]]
What has to be done to allow a package require. I cannot find any Tcl_PkgProvide call in the source code of pikchr.
(2) By Andreas Kupries (akupries) on 2020-12-02 20:36:59 in reply to 1 [link] [source]
I believe that the missing Tcl_PkgProvide
(in the Pikchr_Init
function) is the main issue here.
(3) By drh on 2020-12-04 13:06:41 in reply to 2 [link] [source]
Can you check in a patch, Andreas?
(4) By Andreas Kupries (akupries) on 2020-12-04 15:35:56 in reply to 3 [link] [source]
I will try.
(5) By Andreas Kupries (akupries) on 2020-12-04 20:30:25 in reply to 4 [link] [source]
Richard, see commit [c85d8111c2] on branch "piktcl-package-build-fix".
(6) By Andreas Kupries (akupries) on 2020-12-04 21:21:41 in reply to 5 [source]
Thanks for the fixes and merge.