I am using Rcpp
for speeding-up for loops in my package functions. Chapter 15 in R Packages book says:
Whenever you use C++ code in your package, you need to clean up after yourself when your package is unloaded. Do this by writing a .onUnload() function that unloads the DLL:
.onUnload <- function (libpath) {
library.dynam.unload("mypackage", libpath)
}
So, I created a file unload.R
in the R
folder within my package folder and put the above code in it. But now I am getting the following warnings:
> checking whether the namespace can be unloaded cleanly ... WARNING
---- unloading
Warning message:
.onUnload failed in unloadNamespace() for 'carfollowingmodels', details:
call: library.dynam.unload("mypackage", libpath)
error: DLL 'mypackage.dll' was not loaded
> checking whether the namespace can be unloaded cleanly ... WARNING
---- unloading
Warning message:
.onUnload failed in unloadNamespace() for 'carfollowingmodels', details:
call: library.dynam.unload("mypackage", libpath)
error: DLL 'mypackage.dll' was not loaded
> checking compiled code ... NOTE
Note: information on .o files for i386 is not available
Note: information on .o files for x64 is not available
File 'C:/Users/umair/AppData/Local/Temp/RtmpiWZMKo/carfollowingmodels.Rcheck/carfollowingmodels/libs/i386/carfollowingmodels.dll':
Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
Found 'exit', possibly from 'exit' (C), 'stop' (Fortran)
Found 'printf', possibly from 'printf' (C)
File 'C:/Users/umair/AppData/Local/Temp/RtmpiWZMKo/carfollowingmodels.Rcheck/carfollowingmodels/libs/x64/carfollowingmodels.dll':
Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
Found 'exit', possibly from 'exit' (C), 'stop' (Fortran)
Found 'printf', possibly from 'printf' (C)
Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs. The detected symbols are linked into the code but
might come from libraries and not actually be called.
See 'Writing portable packages' in the 'Writing R Extensions' manual.
0 errors √ | 2 warnings x | 1 note x
What am I missing here? Note that if I don't use the unload.R
file, I don't get any warnings. But still get the note.