Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在Embarcadero RAD Studio XE中使用Visual Studio DLL?_C++_Visual Studio_C++builder_Dllimport_Hunspell - Fatal编程技术网

C++ 在Embarcadero RAD Studio XE中使用Visual Studio DLL?

C++ 在Embarcadero RAD Studio XE中使用Visual Studio DLL?,c++,visual-studio,c++builder,dllimport,hunspell,C++,Visual Studio,C++builder,Dllimport,Hunspell,我打算在CableCAREO RAD StudioXe./P>中添加一个拼写检查程序到VCL表格C++项目中。 到目前为止,我按照中的步骤成功地创建了一个在Visual Studio 2012中使用hunspell的应用程序。因此,我的第一种方法是重用在RAD Studio中使用VS编译器创建的.dll #include <vcl.h> #pragma hdrstop #include "Unit1.h" //------------------------------------

我打算在CableCAREO RAD StudioXe./P>中添加一个拼写检查程序到VCL表格C++项目中。 到目前为止,我按照中的步骤成功地创建了一个在Visual Studio 2012中使用hunspell的应用程序。因此,我的第一种方法是重用在RAD Studio中使用VS编译器创建的.dll

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;


// dll path
const wchar_t* library = L"libhunspell.dll";

//  hunspell constructor
extern "C" __declspec(dllimport) hunspell_initialize(char const * aff,char const * dic);

//adds a word to the loaded dictionary
extern "C" __declspec(dllimport) int add(char const *) ;


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    HINSTANCE load;
    try
    { load = LoadLibrary(library); }
    catch(Exception &e)
    { ShowMessage(e.Message); }
    if (load)
    {
        ShowMessage("Library Loaded!");

        hunspell_initialize("de_DE.aff","de_DE.dic");
        add("myword");
    }
    else {ShowMessage ("Library hasn't loaded!");}



}
#包括
#布拉格语hdrstop
#包括“Unit1.h”
//---------------------------------------------------------------------------
#pragma包(智能初始化)
#pragma资源“*.dfm”
TForm1*Form1;
//dll路径
const wchar_t*library=L“libhunspell.dll”;
//拼音构造器
外部“C”uu declspec(dllimport)hunspell_u初始化(字符常量*aff,字符常量*dic);
//将单词添加到加载的词典中
外部“C”uu declspec(dllimport)int add(char const*);
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent*Owner)
:t表格(所有者)
{
承受载荷;
尝试
{load=LoadLibrary(库);}
捕获(例外和e)
{ShowMessage(e.Message);}
如果(加载)
{
ShowMessage(“已加载库!”);
输入初始化(“deu de.aff”、“deu de.dic”);
添加(“myword”);
}
else{ShowMessage(“库尚未加载!”);}
}
我可以加载库,但是链接器无法解析外部函数

我的第二种方法是导入hunspell源代码并包含“hunspell.hxx”。但是,我在文件“csuitl.hxx”中得到一个声明语法错误

代码段:

// default flags
#define DEFAULTFLAGS   65510
#define FORBIDDENWORD  65510
#define ONLYUPCASEFLAG 65511

// fopen or optional _wfopen to fix long pathname problem of WIN32
LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode); // << error line

// convert UTF-16 characters to UTF-8
LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);

// convert UTF-8 characters to UTF-16
LIBHUNSPELL_DLL_EXPORTED int u8_u16(w_char * dest, int size, const char * src);
//默认标志
#定义默认标志65510
#定义禁止使用的单词65510
#仅定义YupCaseFlag 65511
//fopen或可选的\u wOpen可修复WIN32的长路径名问题

LIBHUNSPELL_DLL_导出文件*myfopen(常量字符*路径,常量字符*模式);// 如果有人试图在Embarcadero RAD Studio XE中使用Hunspill,或者想知道如何使用Visual Studio在Embarcadero RAD Studio XE中创建的DLL,我最终找到了一个解决方案

命令行提示:

implib -a hunspell.lib hunspell.dll
创建可以添加到项目中的LIB文件。 要查找函数原型,可以通过以下方式创建文本文件:

tdump -ee -m hunspell.dll > out.txt
最后,可以通过以下方式导入函数:

extern "C" __declspec(dllimport) [return type] [function name] ([function parameters]);
有关详细信息,请访问:

Hello@Andreas您能告诉我这个tdump命令是什么吗?