[R] Calling function in DLL using .C

Alex van der Spek doorz at xs4all.nl
Tue Jan 24 23:04:09 CET 2012


Sorry, this works

www.zdoor.home.xs4all.nl


Thank you,
Alex van der Spek

On 01/24/2012 07:21 PM, Duncan Murdoch wrote:
> On 24/01/2012 11:55 AM, Alex van der Spek wrote:
>> Uploaded the DLL here:
>>
>> http://www.filefactory.com/file/c2c56ad/n/Planck.dll
>
> I get:
>
>
>  403 Forbidden
>
> Request forbidden by administrative rules.
>
> Duncan Murdoch
>
>> Appreciate if you can check to see if anything is wrong with this DLL. I
>> use dumpbin to look at what is in the exports table of the DLL. No 
>> reason
>> for concerns there. I can work with this DLL from both VBA and Python.
>> Python's ctypes allow the use of both the C and stdcall versions. Both
>> work fine.
>>
>>
>> By the way, the DLL contains, for every function, one export using C
>> calling conventions for use in R (name appended with R) and one export
>> using stdcall for use with VBA/Python, the latter using decorated names.
>>
>> Reading up on gcc in the mean time.
>>
>> Thank you,
>> Alex van der Spek
>>
>> >  On 24/01/2012 10:35 AM, Alex van der Spek wrote:
>> >>  Yes, sorry, I am learning how to do this. I am a simple and ageing
>> >>  physicist who grew up with Fortran and Algol.
>> >>
>> >>  Just wondering if what appears to be an internal R inconsistency 
>> between
>> >>  is.loaded() and .C() can be explained.
>> >>
>> >>  Attempts to compile with gcc to a DLL unsuccessfull so far. That is
>> >>  solely because I have never used gcc before and have a long way 
>> to go.
>> >>  Years ago I taught myself how to use DLLs in VBA, it took 6 weeks to
>> >>  learn how to make sense out of decorated names and Fortran string
>> >>  passing. The use of DLLs in Python was easy. I am OK with investing
>> >>  weeks again to learn how to do this in R but with the apparent
>> >>  inconsistency I am uncertain where to begin. Drop VC97 and use 
>> gcc as a
>> >>  cure all?
>> >
>> >  That would be easiest, because then there would be lots of others
>> >  available to help you.  You may be the only one using your particular
>> >  compiler with R.
>> >
>> >  You could also post the .dll online so others can take a look and see
>> >  what's going on.  We might not be able to tell you how to fix the
>> >  problem with your compiler, but we could likely tell you what it is.
>> >
>> >  Duncan Murdoch
>> >
>> >>  Thanks,
>> >>  Alex van der Spek
>> >>
>> >>
>> >>
>> >>  On 01/24/2012 04:11 PM, Duncan Murdoch wrote:
>> >> >   On 24/01/2012 6:49 AM, Alex van der Spek wrote:
>> >> >>   I cannot understand why a function appears to be available to R
>> >> >>   (is.loaded('planckwR') returns TRUE) but the call with .C 
>> results in
>> >>  an
>> >> >>   error message:
>> >> >>
>> >> >>   C symbol name 'planckwR' not in DLL for package<path to DLL file
>> >>  here>
>> >> >
>> >> >   You posted this question a few days ago, and said you'd try 
>> using gcc
>> >> >   instead of VS.  How did that go?
>> >> >
>> >> >   Duncan Murdoch
>> >> >
>> >>
>> >
>> >
>>
>>
>
>



More information about the R-help mailing list