Datageek
Datageek

Reputation: 26709

Linking static library into R

I have a static library which I am trying to use inside my R package. This is only for internal use.

The libq.a for now is just within ./src folder. I was trying to add the following to src/Makevars:

PKG_LIBS="-l/path/to/lib/libq.a"

Where /path/to/lib is an absolute path to the libq.a location (for testing purposes only). But that doesn't seem to help. Do I have to do anything else in order to load that static library?

Upvotes: 2

Views: 1044

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368409

That should work -- make sure you see the library used on the final link statement when the package is built. Mind you, though, that -L is for the patch and -lq should be all.

Static libraries can also be added directly so try /path/to/lib/libq.a as is as an argument to PKG_LIBS.

Upvotes: 3

Related Questions