libCurl & UNICODE & Multibyte Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

libCurl & UNICODE & Multibyte

Post by Widgets » Wed Jan 07, 2015 8:07 pm

After running into some problems using wxURL, searching through the forum here and googling some, I ended up thinking perhaps I should convert to libcurl as it seems recommended on this forum, only to realize - at least from what I have seen thus far - that libcurl is intended to be compiled as a multi-byte library.

Before I get too far into all the changes moving to libcurl will bring, I would like to ask here to see if I am mistaken in my conclusion, and if not, what the solution might be and what interfacing is needed to use libcurl with a static UNICODE build under MSVC 2010 & wWidgets 3.0.2

TIA for any help, opinions or pointers.

Arnold
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: libCurl & UNICODE & Multibyte

Post by T-Rex » Wed Jan 07, 2015 8:34 pm

Not exactly. Here is a Unicode build of wxCURL (and libcurl which came in ints distro). I don't remember whether I changed anything for Unicode build, but, most likely, I changed something.
You can use diff if you want for the list of changes.

http://we.tl/Q8lKH6raks

Debug/Release static libs compile with Unicode character set fine for me.

Projects are for VS2013. You can downgrade to VS2010 by editing the project/solution files in text editor, I think.

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: libCurl & UNICODE & Multibyte

Post by Widgets » Wed Jan 07, 2015 9:25 pm

Thank you, T-Rex
I've downloaded the wxCurl package and will start compiling the libraries & studying the samples.
Arnold
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: libCurl & UNICODE & Multibyte

Post by Widgets » Thu Jan 08, 2015 4:22 am

Finally got wxCurl & libcurl to compile, but I am having no luck at all after adding the wxCurlDialog example.

I wanted to use this as a test, before wading in to modify the real app I am trying to build

The minimal sample compiles without errors, but it won't link.
The closest I came was to get errors from the link step as:

Code: Select all

1>------ Build started: Project: wxCurlDialog, Configuration: Debug Win32 ------
1>  minimal.cpp
1>libcurld.lib(curl_addrinfo.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _Curl_getaddrinfo_ex
1>libcurld.lib(curl_addrinfo.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _Curl_getaddrinfo_ex
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap
......
This is for the Debug (Unicode, static) version, linking with the wxCurld.lib & libcurld.lib libraries, under MSVC 2010 Express running on Vista 64-bit.

It looks to me as if it is expecting a DLL, judging by the __imp__.... prefix, but I don't understand whether that is so nor why it might be for a statically linked project.

Any help will be most appreciated.
TIA,
Arnold
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: libCurl & UNICODE & Multibyte

Post by T-Rex » Thu Jan 08, 2015 6:01 pm

You need to link your app with ws2_32.lib according to MSDN to resolve these linker errors.

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: libCurl & UNICODE & Multibyte

Post by Widgets » Thu Jan 08, 2015 9:16 pm

Thank you, T-Rex
But of course; :oops:
In some of my other trials I had included that lib, but missed it in this one.
Unfortunately, that only gets rid of the first two errors. It still leaves me with the much more puzzling errors:

Code: Select all

1>------ Build started: Project: wxCurlDialog, Configuration: Debug Win32 ------
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_unbind_s referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_msgfree referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ber_free referenced in function _Curl_ldap
1>libcurld.lib(ldap.obj) : error LNK2019: unresolved external symbol __imp__ldap_memfreeW referenced in function _Curl_ldap
Arnold
PS:
I can find the names in libcurl, but have no clue as to what it will take to sort this out. As far as I can tell I have compiled libcurl as a static lib, but the __imp__ to looks more like DLL export names that the final app is expecting.
Edit 2:
On reviewing the libcurl compile, I realized I get a whole lot of warnings:

Code: Select all

1>  ldap.c
1>f:\pkg\wx\msvc2010\wxcurl\thirdparty\curl\lib\setup_once.h(377): warning C4005: 'EWOULDBLOCK' : macro redefinition
1>          c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\errno.h(132) : see previous definition of 'EWOULDBLOCK'
1>f:\pkg\wx\msvc2010\wxcurl\thirdparty\curl\lib\setup_once.h(378): warning C4005: 'EINPROGRESS' : macro redefinition
Again, they may mean something or they may not :?:
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

User avatar
T-Rex
Moderator
Moderator
Posts: 1198
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: libCurl & UNICODE & Multibyte

Post by T-Rex » Thu Jan 08, 2015 10:41 pm

You can just dig MSDN and find the appropriate lib for missing functions, I think. For this set of functions you need Wldap32.lib according to docs.

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 391
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: libCurl & UNICODE & Multibyte

Post by Widgets » Thu Jan 08, 2015 11:05 pm

Thank you again. Since I found references to those functions in the libcurl code I jumped to the wrong conclusions #-o
=D>
All is good now :D
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Post Reply