On Wed, 18 Aug 2021 at 16:37, Simon Zehnder
<simon.zehn...@googlemail.com> wrote:
>
> Hi folks,
>
> apologies, if I am double posting - I had problems with my mail.
>
> I need some help here from experienced Rcpp developers.
>
> I am coding since some time on an R-package using Rcpp and nlopt. Lately I 
> found out that I could probably use 'nloptr' to include nlopt in my C++ code, 
> which would give a great advantage to users of my package (instead of 
> installing nlopt on their systems by hand).
> I followed the example on 
> https://github.com/jchiquet/RcppArmadilloNLoptExample (the nloptC one) and 
> modified my code accordingly. When I compile my package I get the error
>
> " Error: package or namespace load failed for ‘finmix’ in library.dynam(lib, 
> package, package.lib):
>  shared object ‘nloptC.so’ not found"
>
> In my DESCRIPTION I use in the 'Imports' and the 'LinkingTo' field 'nloptr'. 
> In my NAMESPACE I load 'nloptC' via 'useDynLib(nloptC)'.

Remove this. The example has useDynLib(nloptC) because the package is
called nloptC. Your package is called finmix, so you just need
useDynLib(finmix) in the NAMESPACE.

> What I saw in the example's 'RcppExports.cpp' file is
>
> RcppExport void R_init_nloptC(DllInfo *dll) {
>     R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
>     R_useDynamicSymbols(dll, FALSE);
> }

You have R_init_finmix instead, same reason as above.

-- 
Iñaki Úcar
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to