Are you sure you only ever have one of those things?
Like there's not some realloc going on later in the code.
Then you can do
Code:
static typeGRAMPCopt myOpt;
(*grampc)->opt = &myOpt;
> but for FPGA implementation I cant have dynamic allocation of memory -so cant use malloc or new either.
There's nothing to stop you implementing your own.
If all your allocs are one-time at startup, you can fairly trivially implement.
Code:
static unsigned char mem[10000]; // pick a size
unsigned char *base = mem;
void *malloc( size_t size ) {
void *result = base;
base += (size+3) & 4; // alignment hack for 32-bit processors (use +7 and &8 for 64-bit processors)
return result;
}
calloc is malloc + memset, but the static buffer will be filled with zeros anyway.