I have a piece of C# code, that calls an unmanaged dll.
[DllImport("urlmon.dll", CharSet = CharSet.Ansi)]
private static extern int UrlMkSetSessionOption(int dwOption, string pBuffer, int dwBufferLength, int dwReserved);
This code exists in a windows forms control solution, which will be used in another application targeting at a large audience.
As I understand, the DllImport
attribute, looks for a dll on the system, and if found, pairs the extern
function to it (I mostly know how extern
works in C).
How can I ensure that this dll will be found at the user's system? Should I bundle it with my application (I know how to do that)? Is it certain that it will exist, as it is included with Windows*?
*I've seen many applications crashing because of missing dlls in Windows XP and older, so I don't really trust that argument.