I couldn't think a good title for this.Simple question

Hello friends,
I am not able to understand this,could you help me.I am using Qt creature

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//This is in .h
 class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    void S7API CliCompletion(void *usrPtr, int opCode, int opResult);
    ~MainWindow();
.
.
.

//When I say right click and "add definition in mainwindow" I have got this in .cpp

void MainWindow::CliCompletion(void *usrPtr, int opCode, int opResult)
{
 
}
// Now, My problem what is S7API  here,I have not encountered like this in C language.What does it do here.what is it.Where do I have to look in Dietel book. 
It's certainly a name from some third-party library. You will not find it used in any textbook.

A google search suggests that S7API is a macro for ABI compatibility from libsnap7, which appears to be some sort of Ethernet communications library.

From this file:
https://github.com/SCADACS/snap7/blob/b0260d8eb8fcebd955a769e6043a301b6c1e63a6/examples/cpp/snap7.h

It is either __stdcall (which is a MSVC-specific extension specifying the calling convention) or nothing, depending on whether or not the macro OS_WINDOWS is defined.
Last edited on
Yes I know this is related with third-party library, as actual that I didn't understand,why was it used .What is the aim?Because this function does not return a value.When is this use?
What is the aim [of using the macro S7ABI]?
To ensure ABI compatibility between the caller and callee.

It tells the compiler how to generate code to call this function in the way that the called function expects.

Last edited on
I am new communication engineer ,this is why I don't know perfectly C++.Could you explain more ,if it is possible with little example
Topic archived. No new replies allowed.