How to connect static libraries when creating package R

I am creating a package that R (statistical program) will use, I am not an expert using this application, but I was able to create a very simple package using the following logic, I have some classes in C ++, since the code must be compiled with using the R compiler, and it only allows C code, I have shell C code that calls C ++ methods, and later I have R script that call methods, C code, so basically this is a message such as R ↔ C ↔ C ++.

In the full tutorial that I used to create this package, found here , I add it as a link.

Now my problem is that I need to add some functions to the package that I already created, what I need to do is add the code for late binding to the COM object, which is another product that I created and which is registered using regasm .

This is the C ++ code that I use to try to bind binding to a COM object, I am trying to use IDispatch for this:

{
...
CLSID clsid;    
HRESULT hr = CLSIDFromProgID((WCHAR*)"My Com object ProgId", &clsid);
if(FAILED(hr))                      
  return;   
...     
}

I did not embed all the code, because only with these lines did the compiler already give me problems, the command I use to compile

R CMD SHLIB Cclass.cc C++class.cc

Where "Cclass.cc" has C code that calls C ++ methods, and "C ++ class.cc" is actually C ++ code.

When I compile these classes, the compiler says

"undefined reference to `CLSIDFromProgID@8'collect2: ld returned 1 exit status"

, , , , , ole32.lib oleaut32.lib, .

, , , , CLSIDFromProgID (...) QueryInterface (...). , - , , - , , , .

, , R R, , , c.

+3
1

C/++, Fortran. , IO . Fortran. - R, , Fortran, - . .

, gcc ( , ), C, , , R.

, , R- , C Fortran, .

+2

Source: https://habr.com/ru/post/1709564/


All Articles