[R-pkg-devel] Link compiled C object to internal package file

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Jun 19 14:10:33 CEST 2019

What do you mean by

"call an external text file"

? Text files are data... do you want to open it and read it? Are you familiar with the system.file() function?

On June 19, 2019 5:45:51 AM CDT, mark padgham <mark.padgham using email.com> wrote:
>Dear All,
>I'm developing a package which primarily relies on C code that itself
>has to call an external text file representing a dictionary or lookup
>table. The location of this file is defined in a C macro, the file
>itself packaged in "./inst/dict/<myfile.txt>" and so currently called
>"#define mylocation './dict/<myfile.txt>'". I can load the package and
>all works well, yet the tests fail because the compiled object
>("./src/<myobject.so>") can not find this file **in tests only**. My
>primary request would then be advice for where best to place such files
>that need to be called directly by compiled objects, and how to direct
>the compiled object to such files? Failing that, advice on why such
>attempts at linking compiled objects to external files might fail only
>during tests, yet work otherwise, would be appreciated.
>Other important info: Yes, the external dictionary file **must** be
>linked directly from the compiled object, not at run time. This means
>that no R-based solutions can be implemented, and so the problem can
>only be solved in this case through figuring out how to direct a
>compiled object to connect to an additional package-internal file.
>Thanks in advance,
>R-package-devel using r-project.org mailing list

Sent from my phone. Please excuse my brevity.

More information about the R-package-devel mailing list