pinvoke - How to check if DLL entry point exists in C# without calling the function -
i'm using opentk opengl wrapper. since loads opengl dll (or .so on linux) contains lot of dll imported functions.
the trouble is, drivers don't export of functions. there way check if entry point exists? need since calling function on systems have cause crash if not done in proper sequence. catching entrypointnotfound exception doesn't work in case.
you can p/invoke loadlibrary , getprocaddress calls win32:
[dllimport("kernel32", setlasterror=true)] static extern intptr loadlibrary(string lpfilename); [dllimport("kernel32", charset=charset.ansi, exactspelling=true, setlasterror=true)] static extern uintptr getprocaddress(intptr hmodule, string procname); use loadlibrary load module , handle, , getprocaddress function pointer entry point. if latter returns error, entry point doesn't exist.
Comments
Post a Comment