Skip to content

Commit

Permalink
Merge pull request #769 from nlmixr2/769-no-bin-dparser
Browse files Browse the repository at this point in the history
No binary linkage to dparser
  • Loading branch information
mattfidler authored Aug 14, 2024
2 parents 4614144 + da82e61 commit 6296051
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Imports:
sys,
tools,
utils,
dparser,
dparser (>= 1.3.1-12),
rxode2ll(>= 2.0.9),
data.table (>= 1.12.4),
qs (>= 0.26.3)
Expand Down Expand Up @@ -124,7 +124,7 @@ LinkingTo:
RcppParallel,
RcppEigen (>= 0.3.3.9.2),
StanHeaders (>= 2.21.0.7),
dparser
dparser (>= 1.3.1-12)
Encoding: UTF-8
LazyData: true
Language: en-US
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
changes in the `lotri` package will not require `rxode2` to be
recompiled (in most cases) and will not crash the system.

- `rxode2` also has no more binary linkage to `PreciseSums`

- The binary linkage for `dparser` is reduced to C structures only,
making changes in dparser less likely to cause segmentation faults
in `rxode2` if it wasn't recompiled.

## Bug fixes

- Fix `ui$props$endpoint` when the ui endpoint is defined in terms of the ode instead of lhs. See #754
Expand Down
17 changes: 13 additions & 4 deletions R/rxode-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
setProgSupported(0)
}
.ggplot2Fix()
.linkAll()
} ## nocov end

.iniLotriPtrs <- function() {
Expand All @@ -69,6 +70,16 @@
.Call(`_iniPreciseSumsPtr`, PreciseSums::.preciseSumsPtr())
}

.iniDparserPtr <- function() {
.Call(`_rxode2_iniDparserPtr`, dparser::.dparsePtr())
}

.linkAll <- function() {
.iniLotriPtrs()
.iniPreciseSumsPtr()
.iniDparserPtr()
}


.onAttach <- function(libname, pkgname) {
## For some strange reason, mvnfast needs to be loaded before rxode2 to work correctly
Expand All @@ -77,10 +88,8 @@
if (!interactive()) {
setProgSupported(0)
}
# Setup lotri C linkages using function pointers
.iniLotriPtrs()
# Setup PreciseSums linkage with function pointers
.iniPreciseSumsPtr()
.linkAll()

rxTempDir()
.ggplot2Fix()
v <- utils::packageVersion("rxode2")
Expand Down
3 changes: 3 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,11 @@ SEXP _rxode2_rxQs(SEXP);
SEXP iniLotriPtr(SEXP ptr);
SEXP iniPreciseSumsPtr(SEXP ptr);

SEXP _rxode2_iniDparserPtr(SEXP ptr);

void R_init_rxode2(DllInfo *info){
R_CallMethodDef callMethods[] = {
{"_rxode2_iniDparserPtr", (DL_FUNC) &_rxode2_iniDparserPtr, 1},
{"_iniPreciseSumsPtr", (DL_FUNC) &iniPreciseSumsPtr, 1},
{"_iniLotriPtr", (DL_FUNC) &iniLotriPtr, 1},
{"_rxode2_rxode2parseSetRstudio", (DL_FUNC) &_rxode2_rxode2parseSetRstudio, 1},
Expand Down
10 changes: 9 additions & 1 deletion src/tran.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "genModelVars.h"
#include "print_node.h"
#include <errno.h>
#include <dparser.h>
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
Expand All @@ -26,6 +25,15 @@
#else
#define _(String) (String)
#endif

// change the name of the iniDparser pointer
#define iniDparserPtr _rxode2_iniDparserPtr

#include <dparserPtr.h>

dparserPtrIni;


#include "tran.g.d_parser.h"

#define MXSYM 50000
Expand Down

0 comments on commit 6296051

Please sign in to comment.