- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a visual studio solution with an exe and a DLL.
The code for the DLL has !DEC$ ATTRIBUTES DLLEXPORT statements
The code for the exe has !DEC$ ATTRIBUTES DLLIMPORT statements
If an attempt is made to run the exe without the DLL in the same folder, a message is displayed (by Windows, I think) that the DLL is missing. The message seems to appear before the exe begins to actually run.
When running cases when the exe doesn't need to call any routines in the DLL, is it possible for the exe to run without the DLL being present?
In a related question, is it possible to statically link a DLL to an exe? I ask this because I have a very old DLL that I have been unable to build with visual studio / Intel fortran (code is from ANSYS, I think). It is a very small DLL of about 30k, and I would prefer to link it statically and not have to haul it around with the exe.
Thanks,
Brian
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Yes, it's possible to "delay load" the DLL so that it doesn't actually try to load until you call the routine. See https://msdn.microsoft.com/en-us/library/151kt790.aspx for more details. In particular you must link in delayimp.lib (this is one of the Windows support libraries provided) and then name the DLL in the /delayload linker option. No code changes are needed.
2. No.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Steve. I will read through the stuff at those links. If it's not over my head, it looks like it will do exactly what I asked.
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you're using the bundled VS2010 Shell, you may not have delayimp.lib. If that's the case, you can either get it from the Windows SDK or update to the 2016 compiler with VS2013 Shell. I think we updated the shell installer in 2015U2 or thereabouts to fix this (MS had not included this in the files we could redistribute initially.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've got retail VS2010, and there is delayimp.lib in the visual studio 10.0\VC\lib folder. So I should have what is needed.
Thanks
Brian
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page