C# 如何在C++语言中使用C++ DLL? 我在Dll有一个问题,C.DLL是用C++语言编写的。我想使用dll中的结构和方法。我不知道如何用C语言编写我使用的结构和方法的代码

C# 如何在C++语言中使用C++ DLL? 我在Dll有一个问题,C.DLL是用C++语言编写的。我想使用dll中的结构和方法。我不知道如何用C语言编写我使用的结构和方法的代码,c#,c++,dll,C#,C++,Dll,C++代码: 这是标题 #ifndef _FILTERS_H_ #define _FILTERS_H_ #ifdef __DLL # define DLLIMPORT __declspec (dllexport) #else # define DLLIMPORT __declspec (dllimport) #endif #define _AFXDLL #include <string> #include <iostream> #include <sstrea

C++代码: 这是标题

#ifndef _FILTERS_H_
#define _FILTERS_H_

#ifdef __DLL
# define DLLIMPORT __declspec (dllexport)
#else
# define DLLIMPORT __declspec (dllimport)
#endif

#define _AFXDLL

#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <Wingdi.h>
///#include <windows.h>
///#include <afxwin.h>
#include <windef.h>

using namespace std;
///using namespace Gdiplus;
///#pragma comment (lib,"Gdiplus.lib")
#pragma comment (lib,"Gdi32.lib")
///using namespace System;
///using namespace System::Drawing;



#ifdef EXPORTING_DLL
#ifndef _RDT_
extern struct __declspec(dllexport) SCIOX_bitmap{
    int width;
    int height;
    int color_depth;
    int* points;
};
#endif
extern __declspec(dllexport) SCIOX_bitmap median(SCIOX_bitmap image, int size);
#else   


#ifndef _RDT_
class __declspec (dllimport) DllClass
{
  public:
    DllClass();
    virtual ~DllClass(void);

  private:

};
#endif


#ifndef _RDT_
#define _RDT_
#endif

#endif /* _FILTERS_H_ */

我要打电话给媒体;在C语言中。

这里有很多示例,请按以下方式搜索:dllimporti如果您对pinvoke的了解还不够,甚至还没有入门,那么这肯定不是您想要开始使用的函数类型。在地板垫下面隐藏着非常模糊的内存管理问题。强烈建议使用C++/CLI。不要在类型上使用u declspecdllexport。在普通的旧数据上,如SCIOX_位图,它是无用的。在像DllClass这样的功能类上,这是有害的。习惯于导出接受this指针作为显式参数的全局函数。它们可以将对象的成员函数称为实现的一部分,但是成员函数不能以稍微轻便的方式导出。第三选项-将C++类转换为COM自动化启用的类,并使用COM互操作来代替P/UnjKE调用。如果您不熟悉COM,请阅读ATL并谨慎操作;COM在C++方面是有毛茸茸的。