Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to have a DLL work on different Windows versions?
    primarykey
    data
    text
    <p>I'm compiling my own DLL comprised of several <code>.o</code> files. One of the <code>.o</code> files has a function that calls <code>SHLoadLibraryFromItem</code> that is supported on Windows 7 only. The function is never called unless the application that uses the DLL is running on Windows 7. (Yes, I'm sure.)</p> <p>However, when running the application on an older version of Windows (say, XP), the entire application crashes upon launch with an error "The specified procedure could not be found." Although the error doesn't specify which procedure could not be found, if I comment out the call to <code>SHLoadLibraryFromItem</code>, then everything works fine.</p> <p>Questions:</p> <ol> <li>Why is Windows attempting to find <code>SHLoadLibraryFromItem</code> even though it's not being called on XP?</li> <li>Is there any way to have Windows <em>not</em> do that, i.e., find <code>SHLoadLibraryFromItem</code> only when running Windows 7, i.e., some kind of lazy binding?</li> <li>If not, what's the best way around this?</li> </ol> <p>The only way's around this that I can think of are either:</p> <ol> <li>Use <code>LoadLibrary</code> to load the Windows DLL that <code>SHLoadLibraryFromItem</code> is in and use <code>GetProcAddress</code> to obtain the address manually into a pointer-to-function and use the pointer to call <code>SHLoadLibraryFromItem</code> instead?</li> <li>Have two DLLs: one that contains functions that are supported for Windows 7 that will be loaded only when running on Windows 7.</li> </ol> <p>Any other ideas? I'd really prefer some kind of lazy binding as mentioned above.</p> <h1>Update</h1> <p>PLEASE READ WHAT I ACTUALLY WROTE. I clearly stated in the first paragraph that <code> SHLoadLibraryFromItem</code> is <em>not</em> called unless I KNOW FOR CERTAIN that the application ACTUALLY IS RUNNING ON WINDOWS 7.</p> <p>The application crashes merely when the DLL is <em>loaded</em>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload