首页 > 解决方案 > 错误:在 r 包开发中未加载 DLL 'mypackage.dll'

问题描述

我正在使用Rcpp我的包函数中的循环加速。R Packages 书中的第 15 章说:

每当您在包中使用 C++ 代码时,您需要在卸载包时自行清理。通过编写一个卸载 DLL 的 .onUnload() 函数来做到这一点:

.onUnload <- function (libpath) {
  library.dynam.unload("mypackage", libpath)
}

所以,我在我的包文件夹unload.R中的文件夹中创建了一个文件,R并将上面的代码放入其中。但现在我收到以下警告:

> 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 

我在这里想念什么?请注意,如果我不使用该unload.R文件,我不会收到任何警告。但还是得到了笔记。

标签: rrcppr-package

解决方案


推荐阅读