3
typedef struct st
{
    int x; 
}tConfig;

class CRLDownload 
{
    public:
        CRLDownload();
        ~CRLDownload();
        void run(tConfig config);

};

How to make CLI/C++ wrapper of C++ native. I want to use this tConfig struct and class in windows service project.

1 Answers1

0

You cannot use an native class/struct into managed code. You will have to create an equivalent class in your managed code. You can use visual studio to create an CLR application, using which you can create a reference class which will work as a wrapper to your native code.

You will need to write a wrapper for each function you want to use. Writing a function is similar to writing functions for any other native class, and then you can reference the dll in your windows service and use the functions like any other managed function.

You can refer to Quick-C-CLI-Learn-C-CLI-in-less-than-minutes for a quick example.

Vikash Kesarwani
  • 850
  • 5
  • 14
  • I tried a lot but need more detail about it.. CLI library I want To use in windows service project... so at some level I am facing problem.. –  May 15 '16 at 06:58