Can we have a precompiled file called by DPI like .obj file?

No one can help you when you say something is not working and do not explain what it is that is not working.

You should read Appendix E of the Questasim User Manual, section Compiling and Linking C Applications for Interfaces