How to provide linked C library to sim for DPI

What is the correct way to pass linked C library to the simulator for the C routines to access the C functions defined in the linked library?

For example, this C file has the proper header include <mylibrary.h> and runs fine outside of simulator:

gcc cside_api.c -lmylibrary -o runme.exe
./runme.exe // access to FUNCTION_A() defined in mylibrary works fine

However, when the same c file is used in simulation via DPI, it has issues accessing this same function when the linked library is specified as c compiler flag using.

vlog -sv -dpiheader dpiheader.h hdl_top.sv cside_api.c -ccflags “-lmylibrary” // mylibrary contains the implementation of FUNCTION_A

The error message is as follows when sim is run:

** Fatat: Undefined function ‘FUNCTION_A’ introduced from ‘dpi_30434/linuxpe_gcc-4.4.7/vsim_auto_compile.so’ is being called. Exiting …

Is --ccflags as shown above the correct way to specify a linked library to sim? Am I missing additional steps?

Thank you in advance for your help!

In reply to rogmix:

Linking DPI code is tool dependent, and this forum is not for tool related issues. Please contact your tool vendor for additional support.