【发布时间】:2014-04-03 12:59:14
【问题描述】:
我有一个 .lib,它有一个我想制作成 DLL 的函数。
在项目属性中,我做了两件事, 1.在C/C++ -> General -> Additional Directories:添加.h文件的路径。 2.在Linker->General->Additional Dependies:添加.lib文件的路径
然后我做了一个.h文件
#ifndef _DFUWRAPPER_H_
#define _DFUWRAPPER_H_
#include <windows.h>
#include "DFUEngine.h"
#ifdef __cplusplus
extern "C" {
#endif
__declspec(dllexport) void helloworld(void);
__declspec(dllexport) void InitDLL();
#ifdef __cplusplus
}
#endif
#endif
并制作了 .cpp 文件
#include "stdafx.h"
#include "stdio.h"
#include "DFUWrapper.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif
void helloworld(void)
{
printf("hello world DFU");
}
DFUEngine* PyDFUEngine()
{
return new DFUEngine();
}
void delDFUEngine(DFUEngine *DFUe)
{
DFUe->~DFUEngine();
}
void PyInitDLL(DFUEngine *DFUe)
{
return DFUe->InitDLL();
}
我用函数 helloword 做了一个测试。我可以在 DLL 中看到这个函数,但在 InitDLL 函数中看不到。 我怎么能解决这个问题?请帮忙
【问题讨论】:
-
Visual Studio,大概。什么版本?您无法“看到”该功能是什么意思?显示一些数据/错误/输出。
-
我正在使用 VS2005。我正在检查依赖步行者。我可以看到 halloworld() 函数,但看不到 InitDLL()
-
在你的 .c 文件中是
PyInitDll。在您的 .h 中,它是InitDll
标签: c++ dll visual-studio-2005