From ligges at statistik.tu-dortmund.de  Sun Apr 28 16:27:21 2013
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Sun, 28 Apr 2013 16:27:21 +0200
Subject: [Rd] dyn.load inside a package in R >= 3.0
In-Reply-To: <23F5015AB166A946A49A38282DB0C3E2C2B9A4@EXCHMBOXB01.pc.factset.com>
References: <23F5015AB166A946A49A38282DB0C3E2C2B9A4@EXCHMBOXB01.pc.factset.com>
Message-ID: <517D31C9.5080101@statistik.tu-dortmund.de>



On 24.04.2013 19:55, Adrian Mejia wrote:
> Hello,
> I am trying to port a package that was built for R 2.15 over to R 3.0. This package has an Initialize method that uses dyn.load to load a dll that was built separately, and then uses .C() to make calls on the functions in that dll. This worked fine in 2.15, however, I see that now for 3.0 .C() will only search in the namespace of your current package. This seems to make it impossible to use dyn.load for loading a dll, as I can't find a way to get the loaded dll to belong to the namespace of the package that is using it. It tells me that the function I'm trying to call is not resolved from the current namespace, or if pass the .C function a value for the PACKAGE optional argument it tells me that the symbol is not available for .C() for the package.
> Is there a way to still use dyn.load to use a dll inside my package? Do I need to change the structure of my project to still be able to use my dll?

If you need an example for such an ugly hack, see how we did it in the 
BRugs package.

Best,
Uwe Ligges





> Thanks
> Adrian
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] dyn.load inside a package in R >= 3.0
Uwe Ligges