24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

gcc compiler<br />

gcc -c -I//modeltech/include app.c<br />

ld -G -Bsymbolic -o app.so app.o -lc<br />

cc compiler<br />

64-bit Solaris platform<br />

cc -c -I//modeltech/include app.c<br />

ld -G -Bsymbolic -o app.so app.o -lc<br />

Compiling <strong>and</strong> linking C applications for PLI/VPI/DPI UM-571<br />

When using -Bsymbolic with ld, all symbols are first resolved within the shared library at<br />

link time. This will result in a list of undefined symbols. This is only a warning for shared<br />

libraries <strong>and</strong> can be ignored.<br />

gcc compiler<br />

gcc -c -I/modeltech/include -m64 -fPIC app.c<br />

gcc -shared -o app.so -m64 app.o<br />

This was tested with gcc 3.2.2. You may need to add the location of libgcc_s.so.1 to the<br />

LD_LIBRARY_PATH environment variable.<br />

cc compiler<br />

32-bit HP700 platform<br />

cc -v -xarch=v9 -O -I/modeltech/include -c app.c<br />

ld -G -Bsymbolic app.o -o app.so<br />

When using -Bsymbolic with ld, all symbols are first resolved within the shared library at<br />

link time. This will result in a list of undefined symbols. This is only a warning for shared<br />

libraries <strong>and</strong> can be ignored.<br />

A shared library is created by creating object files that contain position-independent code<br />

(use the +z or -fPIC compiler argument) <strong>and</strong> by linking as a shared library (use the -b linker<br />

argument).<br />

If your PLI/VPI/DPI application uses anything from a system library, you’ll need to specify<br />

that library when you link your PLI/VPI/DPI application. For example, to use the st<strong>and</strong>ard<br />

C library, specify ‘-lc’ to the ‘ld’ comm<strong>and</strong>.<br />

gcc compiler<br />

gcc -c -fPIC -I//modeltech/include app.c<br />

ld -b -o app.sl app.o -lc<br />

cc compiler<br />

cc -c +z +DD32 -I//modeltech/include app.c<br />

ld -b -o app.sl app.o -lc<br />

Note that -fPIC may not work with all versions of gcc.<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!