You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to implement a function in the cwbtools package that performs a testload for a corpus,
I realized some really odd behavior of the cqp_get_registry() function.
The cqp_get_registry() works as expected, if cqp_initialize() has been
called before tbe first call of cqp_get_registry(). Given the two
alternative registry directories used in the following example exist,
the following code works.
But if cqp_get_registry() is called before cqp_initialize(), cqp_get_registry() will grab strings from memory in an unexpected and
definitely unintended manner.
library(RcppCWB)
cqp_get_registry() # Problems when called before cqp_initialize
cqp_initialize()
cqp_get_registry()
Looking at the C code of the cl_standard_registry() C function that is
the worker behind the R function cqp_get_registry(), I find it hard
(impossible at this stage) to understand what happens.
cl_standard_registry()
{
if (regdir==NULL)
regdir=getenv(REGISTRY_ENVVAR);
if (regdir==NULL)
regdir=REGISTRY_DEFAULT_PATH;
returnregdir;
}
A workaround might be to call cqp_initialize() by default upon loading
RcppCWB. But that would be a workaround and I am deeply dissatisfied with, as I do not
yet understand the odd behavior reported.
The text was updated successfully, but these errors were encountered:
A new implementation of cqp_get_registry() does not reference the regdir variable which may have been overwritten, but the registry variable. I think this solved the issue.
Trying to implement a function in the cwbtools package that performs a testload for a corpus,
I realized some really odd behavior of the
cqp_get_registry()
function.The
cqp_get_registry()
works as expected, ifcqp_initialize()
has beencalled before tbe first call of
cqp_get_registry()
. Given the twoalternative registry directories used in the following example exist,
the following code works.
But if
cqp_get_registry()
is called beforecqp_initialize()
,cqp_get_registry()
will grab strings from memory in an unexpected anddefinitely unintended manner.
Looking at the C code of the
cl_standard_registry()
C function that isthe worker behind the R function
cqp_get_registry()
, I find it hard(impossible at this stage) to understand what happens.
A workaround might be to call
cqp_initialize()
by default upon loadingRcppCWB. But that would be a workaround and I am deeply dissatisfied with, as I do not
yet understand the odd behavior reported.
The text was updated successfully, but these errors were encountered: