2

I have a question regarding the exporting method of a class from c++ DLL to c# program.

I used an interface function to call a c++ class in the DLL. It works fine between a c++ DLL caller executible and the DLL.

But I have no idea how to export the same DLL for a c# program to use.

Here is my interface class:

extern "C" __declspec(dllexport) COGInterface* __cdecl CreateCOGInterfaceObject()
{   
   return new COGDLL;
}

And main class in the DLL:

class COGDLL : public COGInterface {
public:
    COGDLL(){}
    ~COGDLL(){} ....

And it is the header file

class COGInterface
{
public:
    virtual ~COGInterface() {};


    public:
        virtual void InitializeClass(bool Side, bool GPUReady, bool PartialUseCUDA, int cpuCount, bool Reviewer, int Num, double TopThres, double BottomThres, bool WriteDebugImages) = NULL;
        virtual int ImageLoader(Mat image) = NULL;
        virtual int MainProcess() = NULL;
        virtual void Terminate() = NULL;
    };

Do I have to convert the DLL to a static libray then wrap it with a CLI class?

Thanks,

user1098761
  • 579
  • 1
  • 5
  • 16

0 Answers0