dll and R DLLRegisteredRoutines empty

2019-08-21 13:54发布

问题:

I have a problem with loading/using a 32-bit DLL. I am using this web site as advice: http://stat.ethz.ch/R-manual/R-devel/library/base/html/dynload.html

I want to load the swedll32.dll (C: which is compiled using: Visual Studio and another version is done with MinGW). The documentation (to use the dll is here: ftp://ftp.astro.com/pub/swisseph/doc/swisseph.htm#_Toc502931278 )

x <- dyn.load("swedll32.dll")
x

gives:

DLL name: swedll32
Filename: C:/Users/VRHome/Documents/R/ARCHAECOSMO/ARCHAEOCOSMO/swedll32.dll
Dynamic lookup: TRUE

It looks to be loaded:

getLoadedDLLs()
#...
swedll32       C:/Users/VRHome/Documents/R/ARCHAECOSMO/ARCHAEOCOSMO/swedll32.dll
#...
swedll32              TRUE

But:

getDLLRegisteredRoutines(x)

gives:

 data frame with 0 columns and 0 rows

and using https://darrenjw.wordpress.com/2010/12/30/calling-c-code-from-r/ to run a function in the dll:

.C("swe_get_tid_acc") 
Error in .C("swe_get_tid_acc") : 
C symbol name "swe_get_tid_acc" not in load table

So the issue might be that the swedll32 routines (C-functions) are not registered ('data frame' is 0 by 0)... So perhaps I need to register the functions in similar way (https://en.wikipedia.org/wiki/Dynamic-link_library#Microsoft_Visual_Basic_2) as VBA? But how, what information do I need to ask from the dll author?

Any hints to get this to work is welcome. I am new to using DLLs as part of other code (I use this dll in VBA for Excel plug-in). Thanks in advance

All the best,

Victor

标签: r dll