Next: , Previous: Linking with foreign object files, Up: Interfacing to other languages


5.9.4 Starting a simulation from a foreign program

You may run your design from an external program. You just have to call the ‘ghdl_main’ function which can be defined:

in C:

     extern int ghdl_main (int argc, char **argv);

in Ada:

     with System;
     ...
     function Ghdl_Main (Argc : Integer; Argv : System.Address)
        return Integer;
     pragma import (C, Ghdl_Main, "ghdl_main");

This function must be called once, and returns 0 at the end of the simulation. In case of failure, this function does not return. This has to be fixed.