简体   繁体   English

DLL插件基本问题

[英]Dll Plug-in basic questions

For the last couple of days i've been learning C++ to make a dll plug-in for a program. 在过去的几天里,我一直在学习C ++为程序编写dll插件。

My objective is to get data(the Flight Plan's to be more precise) from the program and on a first phase save them to a text file(second phase will be connect them with python but for now it's just that). 我的目标是从程序中获取数据(更准确地说是飞行计划),并在第一阶段将其保存到文本文件(第二阶段将它们与python连接,但现在仅此而已)。 So in my header file i imported a file with many classes and many functions(which is given by the plugin development guide). 所以在我的头文件中,我导入了一个包含许多类和许多功能的文件(由插件开发指南提供)。 The class i'm interested in is the class CAircraftFlightPlan and it has some functions inside like this: 我感兴趣的类是CAircraftFlightPlan,它内部具有如下功能:

bool IsReceived(void) const;
//-----------------------------------------------------------------
//  Return :
//      true    - if any kind of FL is received from the servers
//      false   - else
//-----------------------------------------------------------------

const char * GetOrigin ( void ) const ;
//-----------------------------------------------------------------
//  Return :
//      The origin airport.
//-----------------------------------------------------------------


int     GetFinalAltitude ( void ) const ;
//-----------------------------------------------------------------
//  Return :
//      The final requested altitude.
//-----------------------------------------------------------------

I have many doubts about this, hope you can help: 我对此有很多疑问,希望您能提供帮助:

1-what does it mean having "nameoffuction"(void) const? 1-具有“ nameoffuction”(void)常量意味着什么? It receives nothing?how do i call these functions then 它什么也没收到?我该如何调用这些函数

2-i do not understand this function "const char * GetOrigin ( void ) const ;",what does it want, a const or a char? 2-i不理解此函数“ const char * GetOrigin(void)const;”,它想要的是const还是char?

3-The comments below the functions tell that they return this or that. 3-函数下面的注释表明它们返回了this或that。 But how do they return that if the function is empty, it's just "int GetFinalAltitude(void) const"... 但是,如果函数为空,它们如何返回它,它只是“ int GetFinalAltitude(void)const” ...

4-In the source file, i try to call one of the functions to write it to a txt file,how can i do this: 4-在源文件中,我尝试调用函数之一以将其写入txt文件,我该怎么做:

int airplane;
ofstream textfile;
textfile.open("FP.txt");
textfile<<int GetTrueAirspeed("MAH545"); //i know there's an error here, how do i solve it?
textfile.close();

I'm very sorry for asking these (noob i suppose) questions but they are way to specific to search for an answer online(i tried already) 我很抱歉问这些(我想是菜鸟)问题,但是它们是特定于在线搜索答案的方式(我已经尝试过)

Thank you for the help 感谢您的帮助

  1. Yes, it takes no arguments so you call it like so: nameoffunction() 是的,它没有参数,因此您可以这样调用它: nameoffunction()

  2. This also takes no arguments so it is called as GetOrigin() . 这也没有参数,因此称为GetOrigin() It returns a pointer to a const char . 它返回一个指向const char的指针。

  3. As above, the functions take no arguments but do return values. 如上所述,这些函数不带参数,但返回值。

  4. Delete the int in front of the function call. 删除函数调用前面的int This should get rid of at least one error. 这应该消除至少一个错误。

    textfile<< GetTrueAirspeed("MAH545"); textfile << GetTrueAirspeed(“ MAH545”);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM