Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to debug Dynamic-link libraries

intelhelp2009
Beginner
1,542 Views
Hi,

I am learning how to build Dynamic-Link librariesby usingintel Fortran Compiler 11.0.061. The help file under that topic says: " To debug a DLL, you must use a main program that calls the library routines." I added a main program file ina DLL project and started debugging. However it gave the following error message:" Visual Studio cannot debug because a debug target has not been specified." How to solve this problem?


Thanks!
0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,542 Views

Remove the main program file. Right click on your DLL project and select Properties > Debugging. In the Command field, enter the path to the executable that loads your DLL. Set a breakpoint in your DLL routine and then start debugging.
0 Kudos
intelhelp2009
Beginner
1,542 Views

Remove the main program file. Right click on your DLL project and select Properties > Debugging. In the Command field, enter the path to the executable that loads your DLL. Set a breakpoint in your DLL routine and then start debugging.

Thanks for the reply. I tried to build executable that loads the DLL. The help file says:" when you build the executable that imports the procedures or data defined in the DLL, you must link using the import library". How to create this "import library"?

Thanks!
0 Kudos
Steven_L_Intel1
Employee
1,542 Views

The import library is created automatically when you build the DLL, as long as you have exported one or more symbols (using a DLLEXPORT attribute). This will be a .LIB file created by the DLL build. If you make the DLL project a dependent of the EXE project (assumes both are in the same solution - right click on the EXE project, select Project Dependencies, and check the box for the DLL project), then the import library will be linked in automatically. Otherwise you can add the .LIB to your EXE project as if it were a source file.
0 Kudos
intelhelp2009
Beginner
1,542 Views

The import library is created automatically when you build the DLL, as long as you have exported one or more symbols (using a DLLEXPORT attribute). This will be a .LIB file created by the DLL build. If you make the DLL project a dependent of the EXE project (assumes both are in the same solution - right click on the EXE project, select Project Dependencies, and check the box for the DLL project), then the import library will be linked in automatically. Otherwise you can add the .LIB to your EXE project as if it were a source file.

It works. Thanks!
0 Kudos
Reply