This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Exporting Matrix derived types

Tags: None
(comma "," separated)
aodtorusan
Registered Member
Posts
1
Karma
0

Exporting Matrix derived types

Wed Nov 28, 2012 11:10 pm
Hi,

I've am creating a dynamic library with a custom Eigen derived type ( class State : public Eigen::Matrix<double, 6, 1>, source code ). Now I would like to export this class into this dynamic library. With msvc 2012 this implies you have to add "__declspec(dllexport)" to the class declaration. However when I then compile my library, It complains that the symbols in Eigen::Matrix have not been exported to the dll;

Code: Select all
State.h(5): warning C4251: 'Eigen::PlainObjectBase<Derived>::m_storage' : class 'Eigen::DenseStorage<T,Size,_Rows,_Cols,_Options>' needs to have dll-interface to be used by clients of class 'Eigen::PlainObjectBase<Derived>'
          with
          [
              Derived=Eigen::Matrix<double,6,1>
          ]
          and
          [
              T=double,
              Size=6,
              _Rows=6,
              _Cols=1,
              _Options=0
          ]
          and
          [
              Derived=Eigen::Matrix<double,6,1>
          ]
eigen/src/Core/Matrix.h(265): error C2338: THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE
          eigen/src/Core/Matrix.h(262) : while compiling class template member function 'Eigen::Matrix<_Scalar,_Rows,_Cols>::Matrix(const double &,const double &,const double &)'
          with
          [
              _Scalar=double,
              _Rows=6,
              _Cols=1
          ]
          State.h(5) : see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols>' being compiled
          with
          [
              _Scalar=double,
              _Rows=6,
              _Cols=1
          ]


(These errors only occur when adding the '__declspec(dllexport)' directive, without it compiles fine)

I also noticed that there is no Eigen preprocessor directive to modify to add such a directive to the matrix class. Does this mean that I should modify the source code to add this directive, or can anyone suggest less intrusive method of exporting my custom type into a dll.

Simon
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Exporting Matrix derived types

Thu Nov 29, 2012 3:06 pm
I'm not competent enough with the windows DLL mechanism to help you much here. What I'd suggest is trying to get a working solution by hacking Eigen's source code, and get back to us to let us know what works for your case. Then we'll see...


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]