> ok, here is one of the little dirty secrets of GHDL that I found > the hard way : when a VHDL function returns a string, well, > it is transformed into a procedure with a hidden additional argument > !
Correct. Note that returning a string is a feature not available in C or in verilog. And to implement it you have to deal with memory management. > Imagine that we have a function : > function f(a : integer) return string; > > it is transformed in C as : > void f(struct ghdl_string *s, int a) > > Oh and I also reverse engineered the memory allocation > system for the strings, because the above transformation > is not sufficient to work. > > Since this ABI/API is very useful and (AFAIK) undocumented, > I have put example code there : http://ygdes.com/GHDL/ghdl_env/ > > Use wisely and carefully, Yes, as there is no warranties that this ABI is stable. Tristan. _______________________________________________ Ghdl-discuss mailing list [email protected] https://mail.gna.org/listinfo/ghdl-discuss
