Page 2 of 2
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Mon Sep 16, 2013 3:34 pm
by mariosk8s
Thanks for the tip @Shardik, but Linux and Mac work.
It's only M$ that's giving me head aches.
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Mon Sep 16, 2013 9:55 pm
by idle
the command was right for creating an import library
you can check the imports generated in the lib file using podump curl.lib /IMPORTS
did you try Import on windows instead of ImportC
and you may need to alias the Imports if they're decorated with an underscore on windows
Import
curl_easy_setopt(curl, tag, value) as "_curl_easy_setopt"
...
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Tue Sep 17, 2013 7:28 am
by Shardik
mariosk8s wrote:Thanks for the tip @Shardik, but Linux and Mac work.
Sorry, my understanding was that you have difficulties with the Linux version, especially as Linux expert idle tried to help you...
mariosk8s wrote:It's only M$ that's giving me head aches.
I had to experience the same head aches when generating the libcurl.lib file for Windows...
This worked for me to generate a usable libcurl.lib for x86 Windows:
- Download the developer version curl-7.30.0-devel-mingw32 from
here (this is the 32 bit version).
- Decompress the downloaded archive
- Change into the
\lib folder
- Edit
libcurl.def
- Insert the following line as top line
LIBRARY libcurl
- Save
libcurl.def
- For ease of operation copy
polib.exe from PureBasic's compiler folder to libcurl's lib folder
- Open console
- CD into libcurl's lib folder
- Generate
libcurl.lib:
> polib /DEF:libcurl.def /OUT:libcurl.lib /MACHINE:x86
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Tue Sep 17, 2013 9:38 am
by mariosk8s
First of all, thanks for your help guys.
@Shardik I managed to create libcurl.lib without a problem, it's subsequent linking that fails. I'm using libcurl built from source 7.32 using mingw. I did not manage to find a libcurl.def anywhere in there through.
@idle Here's what podump reports
Code: Select all
Dump of libcurl.lib
File type: LIB
...
libcurl-4.dll: curl_easy_send (curl_easy_send)
libcurl-4.dll: curl_easy_setopt (curl_easy_setopt)
libcurl-4.dll: curl_easy_strerror (curl_easy_strerror)
...
The first thing i noticed is that the lib uses the original lib name, which i later changed from libcurl-4.dll to libcurl.dll. Making a copy so i have both and then running yields no results either.
Code: Select all
polink.exe -DLL rfsetopt.o -OUT:rfsetopt.dll -DEFAULTLIB:/path/to/libcurl.lib -NOENTRY
POLINK: error: Unresolved external symbol '_curl_easy_setopt'.
POLINK: fatal error: 1 unresolved external(s).
[
So here i'm actually trying to make a lib out of my object file. Only the C code on top of this post is involved. PB is not yet involved.
On the PB side i'm getting the same error. It can find the functions in my wrapper just fine. It's the wrapper's use of curl_easy_setopt that fails to resolve when linking. There's no PB code directly referencing curl_easy_setopt.
I never dreamed, it would be such a bitch making a lib on Windows.

Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Tue Sep 17, 2013 9:57 am
by Shardik
mariosk8s wrote:@Shardik I managed to create libcurl.lib without a problem, it's subsequent linking that fails. I'm using libcurl built from source 7.32 using mingw. I did not manage to find a libcurl.def anywhere in there through.
As I emphasized above you have to download the developer version which definately contains libcurl.def (my above link was to the older version 7.30.0). Here is the link to the newest developer version containing libcurl.def:
http://curl.haxx.se/gknw.net/7.32.0/dis ... ingw32.zip
I would nevertheless advise to generate a new libcurl.lib because I also experienced problems with subsequent linking which all vanished after generating a proper libcurl.lib as described above...

Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Tue Sep 17, 2013 10:14 am
by sec
http://curl.haxx.se/docs/faq.html#Link_ ... ing_libcur
it is needed: libcurl_imp.lib ( download at:
https://github.com/bitmovin/libdash/tre ... ibcurl/lib )
Code: Select all
ImportC "libcurl_imp.lib"
curl_easy_setopt(curl, tag, value) As "_curl_easy_setopt"
EndImport
curl_easy_setopt(0,0,0)
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Wed Sep 18, 2013 8:27 am
by mariosk8s
Shardik wrote:As I emphasized above you have to download the developer version which definately contains libcurl.def (my above link was to the older version 7.30.0). Here is the link to the newest developer version containing libcurl.def:
http://curl.haxx.se/gknw.net/7.32.0/dis ... ingw32.zip
Ah, so it's generated during the build then. And the mingw build probably doesn't generate it.
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Wed Sep 18, 2013 8:42 am
by mariosk8s
Thanks @sec
This post was helpful in bringing me closer. Since i used mingw to build curl i'm using
libcurldll.a.
This made it compile
Unfortunately the then my compiled DLL, not libcurl, won't dlopen
Of course now i'm trying to load a DLL that imports the wrapper function which links to libcurl.
Then i also dlopen libcurl.
Is there some way of debugging OpenLibrary. Currently it just reports "No", but not "Why".
Re: curl_easy_setopt fails on 64 bit CentOS 6
Posted: Fri Sep 20, 2013 1:17 pm
by Kukulkan
Just an idea:
Is there a way to correctly call curl_easy_setopt() by using inline ASM functionality?
In other words: Is it possible to call a function of a loaded DLL from inline ASM?
Maybe this avoids the need of a wrapper and can be done by a macro using ASM?
Kukulkan