Yann Guidon wrote:
> Yann Guidon wrote:
>> I don't want to spend my time reverse-engineering, so :
>> how does one use a C function to get a string from VHDL,
>> and/or return this string itself to other VHDL code ?
>> Can someone decribe the ABI ?

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 !

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,
yg
-- 
http://ygdes.com / http://yasep.org


_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to