C integration with ARRAY VAR

Für Themen rund um logi.RTS und logi.CAD 3
Post Reply
Carlo
Posts: 1
Joined: 23 May 2019, 11:20

C integration with ARRAY VAR

Post by Carlo »

Good morning,
I'm integrating some C code into a logi.CAD 3 project and I need to define the interface for a C-block.
One of the interface variable has to be an ARRAY OF STRING, as show in the code below:

Code: Select all

{extern_c}
FUNCTION_BLOCK readConfigurationFile
	VAR_INPUT
		filePath : STRING[256];
	END_VAR
	VAR_OUTPUT
		content : ARRAY[1..100] OF STRING[256];
		//content_test : ARRAY[1..100] OF DINT;
		//content : STRING[25600];
		content_first_line: STRING[512];
		readLines : UDINT := 0;
	END_VAR
	
END_FUNCTION_BLOCK

And here the C function definition where I would like to access to the variable defined:

Code: Select all

#ifndef LC_PROT_LCFU___READCONFIGURATIONFILE__C
#define LC_PROT_LCFU___READCONFIGURATIONFILE__C

#define _GNU_SOURCE
#include <lcfu___readconfigurationfile.h>
#include <stdio.h>
#include <stdlib.h>

#define V(VAR) (LC_this->LC_VD_##VAR)

/* dimension nodes */
/* array nodes */
/*                            FunctionBlocks                   */
void  lcfu___READCONFIGURATIONFILE(LC_TD_FunctionBlock_READCONFIGURATIONFILE* LC_this, struct _lcoplck_epdb_1_impl* pEPDB)
{
	V(READLINES) = 0;
//		V(CONTENT)[0] = "e";
//		V(CONTENT)[0] = 10;
}
#endif

When I try to build the application the following generic error message appears (the “Problems” tag is empty):

Cattura.PNG
Cattura.PNG (33.52 KiB) Viewed 30481 times

The same happens when I use ARRAY OF DINT.
If I comment the ARRAY definition in the interface file, the build is successfully.
I would like to know if I miss something.

Carlo
u.biakoup
KUNBUS
Posts: 208
Joined: 14 Apr 2022, 13:04

Re: C integration with ARRAY VAR

Post by u.biakoup »

Hello Carlo,
For all questions about Logi.CAD3 software, contact Logicals Support.
Best Regards

Ulrich Kouatang Biakoup | Technical Support
Post Reply