-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not load Rserve dylib into an embedded Rserve instance (fixes #11)
- Loading branch information
Showing
4 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
useDynLib(Rserve, run_Rserve) | ||
export(Rserve, self.ctrlEval, self.ctrlSource, self.oobSend, self.oobMessage, run.Rserve) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## we have to load the dylib/so/DLL by hand | ||
## because it is optional in case we're loaded | ||
## into an embedded Rserve instance | ||
|
||
.register <- c("Rserve_ctrlEval", "Rserve_ctrlSource", | ||
"Rserve_oobSend", "Rserve_oobMsg", | ||
"Rserve_oc_register", "run_Rserve") | ||
|
||
.onLoad <- function(libname, pkgname) { | ||
env <- environment(.onLoad) | ||
## unless we are runnning in an embedded Rserve (which provides | ||
## registration in the "(embedding)" domain) | ||
## we have to load the package dylib | ||
if (!isTRUE(tryCatch(getNativeSymbolInfo(.register[1L])$package[["name"]] == "(embedding)", | ||
error=function(...) FALSE))) | ||
library.dynam(pkgname, pkgname, libname) | ||
for (i in .register) | ||
env[[i]] <- tryCatch(getNativeSymbolInfo(i), error=function(...) NULL) | ||
} |