Thanks for the help, I installed zlib and gnat and can compile the example code. Now I can call standard C functions in vhdl, but I can not call my own functions. Can anyone send me a small example, how to link my own *.c file in the Makefile? I tried to replace the call.

package random is
  function rand return integer;
  attribute foreign of rand : function is "VHPIDIRECT rand";
end random;

with my own method:

package random is
  function rand return integer;
  attribute foreign of rand : function is "VHPIDIRECT foo";
end random;

and I have written a small file (foo.c) returning an integer:

int foo ()
{
    return 17;
}

I compiled it (foo.o), but I don't know how to link it to the work file. Starting the make process returns the following error:

mar...@markus-desktop:~/Desktop/Beispiele$ make
ghdl -a random.vhdl
ghdl -e -Wl,-lm random_tb
random.o: In function `work__random_tb__ARCH__behav__P0__PROC':
random.vhdl:(.text+0xdf): undefined reference to `foo'
collect2: ld gab 1 als Ende-Status zurück
ghdl: compilation error
mar...@markus-desktop:~/Desktop/Beispiele$ make
ghdl -a random.vhdl
ghdl -e -Wl,-lm random_tb
random.o: In function `work__random_tb__ARCH__behav__P0__PROC':
random.vhdl:(.text+0xdf): undefined reference to `foo'
collect2: ld gab 1 als Ende-Status zurück
ghdl: compilation error



Sylvere Teissier schrieb:
or

sudo apt-get install zlib1-dev

it depends of the distribution try both....
  
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

    


  

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

Reply via email to