如何在c ++智能设备中为pda调试dll?

时间:2015-06-15 15:48:29

标签: c++

我是用于智能设备的C ++编程的新手,我正在尝试调试dll。我把这个代码从.h文件做了一个简单的例子到代码我把一个函数添加到两个数字之间并返回结果:

#ifndef DllExport
#define DllExport  __declspec(dllexport)
#endif

#ifndef H_SUMA_DOS_NUMEROS_H
#define H_SUMA_DOS_NUMEROS_H
#include <windows.h>
extern  "C"  DllExport float sum( float n1 , float n2 );

#endif

这是我对cpp文件的代码:

#include "SumadosNumeros.h"
extern  "C" DllExport float sum( float n1, float n2)
{
return n1+n2;
}

这是我的智能设备项目代码的一部分,它从我的dll调用该函数:

#include "stdafx.h"
#include "prueba5.h"
#include "MainFrm.h"
#include "prueba5Doc.h"
#include "prueba5View.h"
#include "SumadosNumeros.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#endif


.......................

BOOL Cprueba5App::InitInstance()
{
float i;
i=sum(1.1,2.2); // here it is my call

我找到了一个教程,表明我必须将路径放在我的dll的.lib中 在链接器中 - &gt;常规 - &gt;其他目录并将我的lib的名称放在链接器中 - &gt;输入 - &gt;其他依赖项(在我的情况下为DLLPrueba.lib)。

我构建并显示0失败,但是当我运行调试器时,我收到下一条错误消息 无法启动程序 %CSIDL_PROGRAM_FILES%\ PRUEBA5 \ PRUEBA5.EXE

但是如果我对我调用函数sum的行进行注释,它会进行调试而不会出错。为什么?为我糟糕的英语道歉。

0 个答案:

没有答案