I am attempting to create a binary package that contains precompiled .dll
files which the package relies on to function. I have the file tkogl2.dll
which needs to be loaded upon usage of the package. After creating the package and attempting to build using devtools::build(binary = TRUE)
I receive the following error:
Error: package or namespace load failed for 'GUImorphTest' in library.dynam(lib, package, package.lib):
DLL 'tkogl2.dll' not found: maybe not installed for this architecture?
错误: 载入失败
停止执行
*** arch - x64
Error: package or namespace load failed for 'GUImorphTest' in library.dynam(lib, package, package.lib):
DLL 'tkogl2.dll' not found: maybe not installed for this architecture?
错误: 载入失败
停止执行
ERROR: loading failed for 'i386', 'x64'
This is most likely due to the NAMESPACE
file, though I am a novice in this process, so I am not entirely sure what it should consist. It currently only contains useDynLib(tkogl2.dll)
which I found to put there from googling. It could also be where I put the .dll in my package. I simply created a libs folder as seen here:
Any help is appreciated, thank you!
edit: Here is onload fct
.onLoad <- function(libname, pkgname) {
chname <- "tkogl2"
file.ext <- .Platform$dynlib.ext #dll file
dlname <- paste(chname, file.ext, sep = "")
if (is.character(.Platform$r_arch) && .Platform$r_arch != "")
path <- file.path("libs", .Platform$r_arc, dlname)
else path <- file.path("libs", dlname)
file <- system.file(path, package = pkgname, lib.loc = libname)[1] #grabs full file name
print(file)
tryCatch(tcl("load", file, "Tkogl2"),
error = function(e)
warning("loading tkogl2 failed", call. = FALSE))
}