Hello! People, tell me, maybe, who faced this.

  1. There is a library in C ++ .lib, there is an API to it, in the form of header files.

  2. There is an example of using the API in C ++

  3. There is a WPF-application on C # in which it is necessary to use this library.

How is this most convenient to do? C ++, unfortunately, I don’t know completely .. :(

  1. The main class from the library to work with (header file):

    class ManagerWindows: public Manager { public: static std::shared_ptr<ManagerWindows> getInstance(); }; 
  2. Here is an example of calling this class:

     std::shared_ptr<ManagerWindows> manager_; manager_ = ManagerWindows::getInstance(); 

I do not even know which side to approach ...

Tried to write CLR-vrapper:

 //library.h namespace Library { public ref class Wrapper { public: std::shared_ptr<ManagerWindows> getInstance(); }; } //library.cpp std::shared_ptr<ManagerWindows> Library::Wrapper::getInstance() { return ManagerWindows::getInstance(); } 

When trying to use from C # this compilation error:

  Wrapper mw; mw = new Wrapper(); object o = mw.getInstance(); 

Error CS0570 'Wrapper.getInstance (?)' Is not supported by the language

  • 2
    Well, write a managed wrapper in C ++ / CLI. To do this, you may need an intelligent programmer who knows both C ++ and .NET. - VladD
  • And what does this library do? Judging by the name of the classes, does it draw the UI? If so, then it is much easier to write your UI on WPF. - VladD
  • Library fucking work with the device - Maxiero
  • Then you need a wrapper, yes. - VladD
  • @VladD, why do we need a wrapper? Isn't it all easy to do through P / invoke? - iluxa1810

0