Reputation: 41
I created dll extensions from Matlab. Then, I want to read that dll in R.
I used dyn.load()
but it does not works.
May you give me some suggestion?
Upvotes: 4
Views: 4006
Reputation: 368271
What language was the source code written in?
The trouble is mixing compilers. The Matlab dll is likely to have been built by Visual Studio. And you simply cannot mix C++ code between different compilers as function identifiers get mangled. You can, with some work, mix C object code. There are some FAQ on the MinGW site.
Upvotes: 2
Reputation: 226332
Based on the discussion in the comment thread below @Mario's answer: I was going to suggest you try the comparison you did (R CMD SHLIB
dll vs Matlab dll) to help diagnose the problem. Based on the result, I think that you need to figure out what the calling syntax for the dll would be in C and write a small C wrapper for it that uses that syntax but is in turn R CMD SHLIB
-able ... R CMD SHLIB --help
says you can include linker options on the command line (i.e. making sure that you are linking your Matlab-callable dll with your R-callable dll), but I'm not sure of the precise syntax. It would probably help to study relevant section of the R Extensions manual a bit.
Upvotes: 1
Reputation: 1851
Some more information is necessary. The regular way to do it is like this:
dyn.load("/path/to/library");
Some pointers:
Upvotes: 0