DigiWEB
C-Schnittstelle
Beispiel mit Destruktor:
Zugriff in Visualisierung:
#$TextArray2[0]
#$TextArray2[1]
typedef struct
{
long dummy;
}tAppData;
tAppData ApplicationData = {0};
StringM* texte[20]={0};
StringM* tAppDataGet_strPrgFeld(tAppData* pStruct, size_t index)
{
if(index>19 || index<0)
return StrCreateM("Error out of bounds");
if(texte[index])
return StrCreateM(texte[index]->str);
return StrCreateM("str undefined");
}
void tAppDataSet_strPrgFeld(tAppData* pStruct, const char* str, size_t index)
{
if(index<20 && index>0)
texte[index]=StrCreateM(str);
}
#ifdef WIN32
void tAppDataDestruct_strPrgFeld(tAppData* pStruct)
{
int i=0;
for(i=0;i<20;i++)
{
if(texte[i])
{
digiFree(texte[i]);
texte[i]=0;
}
}
}
#endif
Seite 26 von 44
Automationsanlagen GmbH
Digitronic
3. Juni 2011