读书人

BCB6 怎么生成dll文件

发布时间: 2012-03-26 15:46:56 作者: rapoo

BCB6 如何生成dll文件
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
//---------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------

double dblValue(double);
double halfValue(double);
extern "C" __declspec(dllexport) double __stdcall changeValue(double,bool);


#pragma argsused


int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
double dblValue(double value)
{
return value*value;
}
double halfValue(double value)
{
return value/2.0;
}
__declspec(dllexport) double __stdcall changeValue(double value,bool whichop)
{
return whichop? dblValue(value): halfValue(value);
}

我写好上面的代码后。我按F9。弹出cannot debug project unless a host application is defined;
然后我按build all project也没见生成dll文件。怎么搞的??求高手解救....


[解决办法]
F9是run的功能,对于DLL工程来说,如果要调试,就需要设置一个Host Application。
如果只是想生成DLL文件,选择菜单中的Project-->Build 工程名就行了。

如果编译没有错误,链接也成功,但是找不到生成的DLL文件,请检查工程选项中,最终输出目录的设置:
Project-->Options-->Directories/Conditionals-->Final output

读书人网 >C++ Builder

热点推荐