Re: [Rd] R-loadable dll with minGW-compiled linked library

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Mon, 29 Aug 2011 13:43:58 -0500

On 30 August 2011 at 02:25, Ilana Lichtenstein wrote:
| The tutorials on the web regarding creation of C++ dlls do not discuss
| linking to libraries.

Well, there are working examples among the 3200+ CRAN packages...

| Thus my two questions are:
| (1) Does anyone know how to compile a C++ program which links to a library,
| which dyn.load will accept? What flags are required in the R makeconf? How
| do you link in a library to the dll? What flags must I compile the libdai
| and boost libraries with?

Sure. I am as self-centered as the next guy so I welcome you to look at my RQuantLib project (on CRAN and R-Forge) which has been doing that for a decade -- and the QuantLib project / library itself uses parts of Boost.

Moreover, Rcpp is a package whose goal it is to make C++ interchange from / to R a little less painful. There are now three dozen packages on CRAN using it (see the 'reverse depends' via the Rcpp CRAN page) and several of these link to other external libraries.

[ All that said, I suspect you need to build everything with MinGW. You certainly cannot mix object code generated via compilers from the visual whichever suites (as C++ function headers get mangled) and I am pretty certain that Cygwin's g++ may be doomed for the same reason. I'd be happy to be convinced otherwise; this would be something worth documenting better. ]

| (2) If my interfacing issue cannot be resolved, does anyone know any tools
| that interface to R that do machine learning belief propagation?

Did you look at the machine learning Task View ?

Dirk

-- 
Two new Rcpp master classes for R and C++ integration scheduled for 
New York (Sep 24) and San Francisco (Oct 8), more details are at
http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10
http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 29 Aug 2011 - 18:46:38 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 29 Aug 2011 - 19:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive