3F / Conari

🧬 One-touch unmanaged memory, runtime dynamic use of the unmanaged native C/C++ in .NET world, related P/Invoke features, and …
MIT License
252 stars 28 forks source link

The BreakPionts Not Work #14

Closed ssc19940105 closed 5 years ago

ssc19940105 commented 5 years ago

Help me!The BreakPionts Not Work!

This my code: using (var conariL = new ConariL(@".\x64\libcurl-x64.dll")) { var curl = conariL.DLR.curl_easy_init(); conariL.DLR.curl_easy_setopt(curl, 10002, "http://www.baidu.com"); var res = conariL.DLR.curl_easy_perform(curl); }

3F commented 5 years ago

What do you mean for "BreakPionts Not Work"?

To be sure,

cURL requires openssl libraries. For x64 (curl-7.67.0-win64-mingw) you need libcrypto-1_1-x64.dll and libssl-1_1-x64.dll

Also provide a return type if exists of course. For LuNari project I already mentioned about data types when string args (we need to consolidate info later), thus please also note: https://github.com/3F/LuNari/wiki/API#data-types

using(var l = new ConariL("libcurl-x64.dll"))
{
    var curl = l.DLR.curl_easy_init<IntPtr>(); // CURL *handle OK: ~0x000002080ea87e10

    //...

    l.DLR.curl_easy_setopt(curl, 10002, "http://example.com");
    var res = l.DLR.curl_easy_perform<long>(curl);
}
3F commented 5 years ago

This is ok:

Good to hear this!

(IntPtr)l.DLR.curl_easy_init();

I recommend exactly generic type because Conari will automatically adapt it for related requests at memory read instead of your example above when you're trying to cast result to IntPtr.

Wrong default type may corrupt processing in some cases. Because:

l.DLR.something<ret_type>() != (ret_type)l.DLR.something()
\-----------------------/                \-------------/

Thanks for using,