protected and typedef

is it possible to initialize protected typedef struct variable?
(Dynamic c 9.62)

for example

typedef struct{
short ID;
unsigned char CardSerialNmb[CardNumberNuberOfBytes];
unsigned long Credit;
long coef_c;
unsigned long inserted;
}Card;
typedef struct {
Card Cards[MAX];
unsigned char outs[MAX];
unsigned char cFlag[MAX];
short IdOfCards[MAX];
unsigned long count_kwh_ltr[MAX];
unsigned long count_old_kwh_ltr[MAX];
unsigned long tmpCount[MAX];
}Db;

protected Db d;

void main()
{

_sysIsSoftReset();

}

It is global variable, on restart data is erased…

Best regards,
Ante

Based on my reading of code in SYS.LIB, it would appear that the protected keyword only applies to built-in types (int, long, float, etc.).

In your situation, you will need to create your own method of ensuring consistency in that data structure. One method would be to keep two copies of it, with a single protected variable indicating which copy to make use of.

Updates go to the “offline” copy. When you’ve confirmed that all changes are complete, toggle your status variable to take the “offline” variable “online” and start copying it to the other variable (now “offline”).