We don't have to specify both libcurl.dll and libcurl in P/Invoke declarations. On Windows it automatically adds .dll suffix to library name, so libcurl is enough. Therefore we don't need two native extern functions and third wrapper choosing one of two.
Removed EntryPoint property of DllImport where method name is same as entry point.
Platform check has been simplified and moved to static constructor of NativeMethods.
We should load x64/x86 version of library relative to assembly, not relative to executable. This matters when running tests etc and has been fixed.
Replaced obsolete curl_escape to curl_easy_escape. This function was marked obsolete in 2006. Also, I fixed handling of string containing NULL characters.
Changes:
libcurl.dll
andlibcurl
in P/Invoke declarations. On Windows it automatically adds.dll
suffix to library name, solibcurl
is enough. Therefore we don't need two native extern functions and third wrapper choosing one of two.EntryPoint
property ofDllImport
where method name is same as entry point.NativeMethods
.curl_escape
tocurl_easy_escape
. This function was marked obsolete in 2006. Also, I fixed handling of string containing NULL characters.