Technical data

Compiling and linking FLI and PLI applications
454
-
VHDL Foreign Language Interface and Verilog PLI ModelSim EE/PLUS Reference Manual
HP700 linkin
g
VSIM loads shared libraries on the HP700 workstation. A shared library is created
by creating object files that contain position-independent code (use the
+z
compiler option) and by linking as a shared library (use the
-b
linker option). Use
these
gcc
or
cc
compiler commands:
gcc compiler:
gcc -c -fpic -I/<install_dir>/modeltech/include app.c
ld -b -o app.sl app.o -lc
cc compiler:
cc -c +z -I/<install_dir>/modeltech/include app.c
ld -b -o app.sl app.o -lc
Note that
-fpic
may not work with all versions of gcc.
for HP-UX 11.0 users
If you are building the PLI/FLI module under HP-UX 11.0, you should not specify
the "-lc" option to the invocation of ld, since this will cause an incorrect version
of the standard C library to be loaded with the module.
In other words, build modules like this:
cc -c +z -I<install_dir>/modeltech app.c
ld -b -o app.sl app.o
If you receive the error "Exec format error" when the simulator is trying to load a
PLI/FLI module, then you have most likely built under 11.0 and specified the "-
lc" option. Just rebuild without "-lc" (or rebuild on a HP-UX 9.0/10.0 machine).
IBM RISC/6000 linkin
g
VSIM loads shared libraries on the IBM RS/6000 workstation. The shared library
must import VSIM's C interface symbols and it must export the C initialization
function. VSIM's export file is located in the Model
Sim
installation directory in
rs6000/mti_exports
.
If your foreign module uses anything from a system library, you’ll need to specify
that library when you link your foreign module. For example to use the standard
C library, specify ‘-lc’ to the ‘ld’ command.
The resulting object must be marked as shared reentrant using the compiler option
appropriate for your version of AIX: