[Rcpp-devel] How to link a .lib file in a rcpp-package in a Windows environment?

Bernhard Pollner bernhard at bpollner.net
Sun Apr 24 18:29:45 CEST 2011


Hello,

I am in the process, i.e. I just began to write a Rcpp-based package for a Windows environment. The purpose of that package will be to read out signals from a USB-connected hardware. The company who is selling this hardware is distributing a SDK for developing custom C-programms to read out those signals, so I have all the required files (.h, .lib, .dll) to compile a working .exe file -- and now, due to some reasons, I want to implement this code in an R-package, and read out the signals from the devices straight from within R.
I am planning to expose the needed C-functions via modules to R, but, unfortunately, I did not even come that far:

Here´s my problem:
I do not know, i.e. it is not clear to me how to link / use the .lib file of the SDK in my package.
(In the instructions coming with the SDK they write:  "... copy the contents of "API \ lib" to your compiler´s lib directory)
Is it possible that I have to use the LDFlags function in src/Makevars.win here somehow? If yes, then I do not know how to write the appropriate code....
I do have two .dll files (which I place in in the src-folder) and I suppose that I just write them into the Namespace-file using "useDynLib(NameOfTheFile)".
But, as I was not able to compile the package yet, I do not know if this is right either...
(And the .h file I just put into the src-folder....)

Could someone, please, show me a way and  the code of how to correctly link the .lib file in my package?
Thank you very much,
with best greetings from Austria,
Bernhard Pollner

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110424/90fab9a3/attachment.htm>


More information about the Rcpp-devel mailing list