From amejia at factset.com  Thu May  2 14:57:07 2013
From: amejia at factset.com (Adrian Mejia)
Date: Thu, 2 May 2013 12:57:07 +0000
Subject: [Rd] dyn.load inside a package in R >= 3.0
In-Reply-To: <517D31C9.5080101@statistik.tu-dortmund.de>
References: <23F5015AB166A946A49A38282DB0C3E2C2B9A4@EXCHMBOXB01.pc.factset.com>
	<517D31C9.5080101@statistik.tu-dortmund.de>
Message-ID: <23F5015AB166A946A49A38282DB0C3E2C2C53D@EXCHMBOXB01.pc.factset.com>

I see that for the x64 architecture a function is used called dyn.open. Is that what puts it in the appropriate namespace? The x86 version uses dyn.load and it doesn't seem to specify a package or namespace.
I can't find any documentation for dyn.open - is it defined somewhere I can't find it?
What would be a less ugly hack for accomplishing this?
Thanks
Adrian

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Sunday, April 28, 2013 10:27 AM
To: Adrian Mejia
Cc: r-devel at r-project.org
Subject: Re: [Rd] dyn.load inside a package in R >= 3.0



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
Adrian Mejia