Forum Discussion
Altera_Forum
Honored Contributor
15 years agoA general rule of thumb: don't rely on standard C libraries for anything you accelerate. Even if they were supported they would probably result in really big and slow hardware. The closest you can get is call malloc from outside the function and then pass in the pointer allocated by malloc to the accelerator.
Think of the accelerator that C2H generates as any standard IP block, it just happens to be generated from C code instead of being based on static Verilog/VHDL. Also I always say this to people I see using malloc: Do you *really* need to allocate your memory at run time? I ask because dynamic memory allocation can lead to problems (what happens in your system if malloc fails to return a pointer for example....)