[ 
https://issues.apache.org/jira/browse/PROTON-660?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14144563#comment-14144563
 ] 

Bozo Dragojevic commented on PROTON-660:
----------------------------------------

{quote}
I don't understand the need to undefine symbols - the windows header file that 
defines them shouldn't be included in any "include chain", and if it is then 
that is a problem. The only files in our code base that should include windows 
(or more broadly platform specific headers) is platform.c and c files that are 
only compiled on specific platforms. None of the .h files should (need to) 
include windows headers.
{quote}

I've got the the bottom of this, and have a cleaner solution, still. The root 
cause is that openssl/ssl.h includes
openssl/x509.h that already has the exact same undefine. But that includes 
happens before it includes openssl/dtls1.h which pulls in winsock.h that 
re-defines the symbols. End effect is, openssl on windows works only if 
winsock.h is explicitly included before any openssl header is included -- which 
I guess is why only some people see this, some not.

So the real solution is a oneliner in ../platform.h to include winsock.h on 
windows. wdyt?

{quote}
The use of strncasecmp() should be abstracted the same way we've abstracted 
snprintf() - by adding a definition to platform.h using some implementation 
probably in platform.c or util.c
{quote}

I've noticed pn_i_eq_nocase() and just followed suit with pn_i_eq_n_nocase().
So, iiuc, that part is OK, I should just leave openssl.c call strncasecmp() and 
add to platform.h a 
{code}
#define strncasecmp(a,b) (!pn_i_eq_nocase(a,b))
{code}

> Fix openssl.c build on windows
> ------------------------------
>
>                 Key: PROTON-660
>                 URL: https://issues.apache.org/jira/browse/PROTON-660
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: 0.8
>         Environment: Windows 7, VS2013
>            Reporter: Bozo Dragojevic
>         Attachments: 0001-PROTON-660-Fix-openssl.c-build-on-windows.patch, 
> 25_openssl_fix_for_windows_CMakeLists.patch, 
> 25_openssl_fix_for_windows_data.h.patch, 
> 25_openssl_fix_for_windows_platform.h.patch
>
>
> Compiled openssl-1.0.1i from source
> Proton finds it, but openssl.c does not compile without small adjustments.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to