andelf / go-curl

golang curl(libcurl) binding.
Apache License 2.0
478 stars 130 forks source link

Problem with compat.h #21

Closed Pyrrvs closed 10 years ago

Pyrrvs commented 10 years ago

Hi,

First, I would like to thank you for your work on go-curl.

In compat.h, you are using ifndefs and defines to define the options/errors/infos that have been added over time to libcurl. From what I understand it has been done in order to allow old version of libcurl to run with go-curl.

The problem is that if you have a look at curl.h, you will see that the options/errors/infos are not #defines, they are part of enums which means that your ifndefs will always evaluate to true and your #defines will shadow the actual values in the enums.

I've been trying to retrieve info like CURLINFO_OS_ERRNO, and got errors from libcurl that say: "A libcurl function was given a bad argument". After removing compat.h, everything worked well.

In my opinion, you should probably remove the compat.h file which prevent the user to use recent features from libcurl.

Best regards, Gauthier Lamaison

andelf commented 10 years ago

Thanks for your help. Yes, it's a mistake. I'll fix it soon.