[R-pkg-devel] Linking to a large external library

matthias-gondan m@tth|@@-gond@n @end|ng |rom gmx@de
Wed Jun 8 22:24:56 CEST 2022


Dear package developers,I think I found a good solution to this problem which may be relevant for some of you. I have written an package ("rolog") that embeds Swi-Prolog so that R can send queries to a prolog interpreter. The thing is working, but very large, I think 15 MB, and CRAN "noted" it. Whenever I add a little feature I have to update the entire package, and so have its users (currently: 0, but that might change). Moreover, people who use the package would normally also have Swi-Prolog on their computer.Therefore, I have now written a second package ("rologlite") that just links to the Swi-Prolog dll, which is much smaller in size than embedding it). It searches for Swi-Prolog in the path, in the registry, in the environment, and if all this fails, it checks if rolog is installed and looks for the swipl dll in the rolog package. If all the above fails, a warning is printed, telling the user to install Swi-Prolog or the rolog package. In its DESCRIPTION it "suggests" rolog so that the latter is available on e.g. CRAN winbuilder when building the vignette or running the unit tests.I prefer this option over downloading and compiling an external library, e.g. in nloptr. Everything is done from within R, self-contained.In case I overlooked something, any hint to an even better way is appreciated.Best wishes Matthias 
	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list