如何将VC ++ DLL链接到MinGW Application? [英] How to link VC++ DLL to MinGW Application?

查看:136
本文介绍了如何将VC ++ DLL链接到MinGW Application?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我使用.h文件创建DLL.

Hi ALL

I Create the DLL Using .h file.

#pragma once
#ifdef USBINTERFACE_EXPORTS
#define USBINTERFACE_API __declspec(dllexport)
#else
#define USBINTERFACE_API __declspec(dllimport)
#endif

class USBINTERFACE_API CExportedClass
{
public:
	CExportedClass(void);
	void TestMessage();
public:
	~CExportedClass(void);
};


.cpp文件


.cpp file

#include "StdAfx.h"
#include "ExportedClass.h"

CExportedClass::CExportedClass(void)
{
}

CExportedClass::~CExportedClass(void)
{
}

void CExportedClass::TestMessage()
{
AfxMessageBox(L"Success");
}



我遵循链接步骤
http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs

命令:
reimp DLLTest.lib
pexports DLLTest.dll> DLLTest.def
dlltool -U -d DLLTest.def -l DLLTest.a

使用上述命令0kb会生成一个文件.
请让我知道如何解决此问题.

谢谢



I follow the link step
http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs

Command:
reimp DLLTest.lib
pexports DLLTest.dll > DLLTest.def
dlltool -U -d DLLTest.def -l DLLTest.a

With the use of above command 0kb .a file generated .
Please let me know how to solve this problem.

Thanks

推荐答案

[^ ]帮助吗?


只是一个想法,但是也许您还需要在标头声明周围包含一些"extern C"包装,以便在导出函数时不进行任何名称修改. :)
Just a thought, but maybe you also need include some "extern C" wrappings around the header declaration so the functions are exported without any name mangling. :)


十年前,COM(Active X)用于在由不同编译器编写的库之间进行通信.如果MinGW支持,那么可能是进行研究的替代方法.
Ten years ago, COM (Active X) was used to communicate between library written by different compilers. If MinGW support it, then it might be an internative to investigate.


这篇关于如何将VC ++ DLL链接到MinGW Application?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆