跳到主要内容

功能块用户编码

C定义功能块

#include ".MODULE/cpp/wa_interface.h"


/************* Function Block c_fb1 *************/
void *
__init_c_fb1(c_fb1_FUNCTION_BLOCK *self) {
return nullptr;
}

void
c_fb1(c_fb1_FUNCTION_BLOCK *self, void *instance) {

}

// if return -1: error, the required size is stored in the buffer.
int c_fb1_save(void *instance, void *buffer, int size) {
return 0;
}

bool c_fb1_restore(void *instance, void *instance_data, int size) {
return true;
}
/*********** End Function Block c_fb1 ***********/

C++定义功能块

#include ".MODULE/cpp/wa_interface.h"

#include "cppfb1.h"

/************* Function Block cppfb1 *************/

cppfb1_Base *new_FB_cppfb1(cppfb1_Data *data) {
/* Add initialization logic here if needed */
return new class cppfb1();
}

cppfb1::cppfb1(): cppfb1_Base() {

}

cppfb1::~cppfb1() {

}

void cppfb1::call(cppfb1_Data *data) {

}

int cppfb1::save(void *buffer, int size) {
return 0;
}

bool cppfb1::restore(void *instance_data, int size) {
return true;
}

/*********** End Function Block cppfb1 ***********/