0

我有两个 VS10 项目,一个是(不是 MFC)DLL。我想在 DLL 项目中使用在struct另一个项目的一个头文件中定义的。这些项目使用预编译的头文件,所有的包含都在stdafx.h.

项目一

struct example
{
  int a;
  int b;
};

DLL 项目

#include "stdafx.h"


extern "C"
{

    __declspec(dllexport) int ex(struct example *p)
    {
        int c = p->a;

        return 1;
    }


}

struct example必须在 DLL 项目中可见。我怎样才能做到这一点?

4

1 回答 1

1

这可以在编译时通过将 Struct 放在单独的头文件中并将其包含在两个项目中来解决。

于 2016-07-14T14:17:05.773 回答