Repository navigation
How to invoke non external functions from c++ programs #1542
prashantbasvat
started this conversation in
General
Replies: 1 comment
|
hi @prashantbasvat
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Is there any way to invoke structure text functions (non external) directly from c++ code.
Here is my code
function.st
FUNCTION SET_VALUE : BOOL
VAR_IN_OUT
INPUTVAR : DINT ;
END_VAR
VAR_INPUT
VALUE : DINT;
END_VAR
INPUTVAR := VALUE
SET_DINTS := TRUE;
END_FUNCTION
main.cpp
#include
extern "C" bool SET_VALUE (int32_t*, int32_t);
int main()
{
int32_t inputVar = 0;
int32_t value = 42;
bool result = SET_VALUE (&inputVar , value);
printf("inputVar : %d \n", inputVar);
return 0;
}
Need to know how to build code?????????
All reactions