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

Can't Create a Fortran DLL independent of VS

Denny_Frost
Beginner
623 Views
I have created a fortran dll using Intel Visual Fortran in VS 2008. I run this dll from excel in a VBA macro. The macro runs fine on my computer, but as soon as I try to run it on other computers in the office, excel throws and error saying it can't find the .dll file. I checked the system log where it said that it failed to find a VS 2008 library during runtime. I would like to make the .dll independent of VS 2008, which I thought it would be already. Is there a compiler setting I missed in order to keep the .dll from using system libraries? Any help would be appreciated!
0 Kudos
1 Solution
DavidWhite
Valued Contributor II
623 Views
You need to link against static libraries when you build the DLL. So use the "Multithreaded" Runtime Library option under Fortran / Libraries.

Also, are you using an Excel Add-In in your Workbook to link to the DLL? If so, Excel puts a hidden path into your workbook which links to this Add-In. This path includes your userid, and so does not work on another computer or for another user. I have found it useful to put the Add-In into XLSTART instead of into the Add-Ins folder, as this does not demonstrate the same issue. I consider this a bug with the Excel Add-Ins system, but don't hold your breath for it to be fixed.

Regards,

David

View solution in original post

0 Kudos
2 Replies
DavidWhite
Valued Contributor II
624 Views
You need to link against static libraries when you build the DLL. So use the "Multithreaded" Runtime Library option under Fortran / Libraries.

Also, are you using an Excel Add-In in your Workbook to link to the DLL? If so, Excel puts a hidden path into your workbook which links to this Add-In. This path includes your userid, and so does not work on another computer or for another user. I have found it useful to put the Add-In into XLSTART instead of into the Add-Ins folder, as this does not demonstrate the same issue. I consider this a bug with the Excel Add-Ins system, but don't hold your breath for it to be fixed.

Regards,

David
0 Kudos
Denny_Frost
Beginner
623 Views
The first suggestion seems to work, thanks a bunch!
Also, the dll is not an add-in. I'm just using the 'Lib' keyword to create a subroutine out of it.
0 Kudos
Reply