> On May 22, 2015, at 6:29 AM, Saheb Biswas <sahebbis...@gmail.com> wrote:
> 
> hello,
> 
> I am trying to port a simple SSL client code into UEFI and am using the 
> OpenSsl in CryptoPkg for this. 
> 
> The OpenSslSupport.h header in CryptoPkg include folder defines most of the 
> stdlib types and this causes a conflict when I attempt to use the StdLib 
> headers in my code. 
> 
> Following is a sample of the error messages: 
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(28) : error C2373: 'FILE' : 
> redefinition; different type modifiers
>         c:\edk2\StdLib\Include\stdio.h(255) : see declaration of 'FILE'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(47) : warning C4005: 'ENOMEM' : 
> macro redefinition
>         c:\edk2\StdLib\Include\errno.h(64) : see previous definition of 
> 'ENOMEM'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(48) : warning C4005: 'EINVAL' : 
> macro redefinition
>         c:\edk2\StdLib\Include\errno.h(74) : see previous definition of 
> 'EINVAL'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(50) : warning C4005: 'INT_MAX' : 
> macro redefinition
>         c:\edk2\StdLib\Include\limits.h(70) : see previous definition of 
> 'INT_MAX'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(51) : warning C4005: 'INT_MIN' : 
> macro redefinition
>         c:\edk2\StdLib\Include\limits.h(67) : see previous definition of 
> 'INT_MIN'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(52) : warning C4005: 'LONG_MAX' : 
> macro redefinition
>         c:\edk2\StdLib\Include\limits.h(79) : see previous definition of 
> 'LONG_MAX'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(53) : warning C4005: 'LONG_MIN' : 
> macro redefinition
>         c:\edk2\StdLib\Include\limits.h(76) : see previous definition of 
> 'LONG_MIN'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(54) : warning C4005: 'ULONG_MAX' : 
> macro redefinition
>         c:\edk2\StdLib\Include\limits.h(82) : see previous definition of 
> ‘ULONG_MAX'
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(75) : warning C4005: 'offsetof' : 
> macro redefinition
>         c:\edk2\StdLib\Include\stddef.h(66) : see previous definition of 
> ‘offsetof'


For issues like this in C you can use #undef 

#undef FILE
#include <OpenSslSupport.h>


> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(83) : error C2371: '__mode_t' : 
> redefinition; different basic types
>         c:\edk2\StdLib\Include\sys/ansi.h(54) : see declaration of ‘__mode_t'

__uint32_t vs. UINT16


> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(84) : warning C4142: benign 
> redefinition of type
> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(85) : error C2371: 'clock_t' : 
> redefinition; different basic types
>         c:\edk2\StdLib\Include\sys/types.h(241) : see declaration of ‘clock_t'

UINT64 vs. unsigned long 

Note: This is scary as long is different sizes on different edk2 compilers!!!!!!

> c:\edk2\CryptoPkg\Include\OpenSslSupport.h(88) : error C2371: 'ino_t' : 
> redefinition; different basic types
>         c:\edk2\StdLib\Include\sys/types.h(169) : see declaration of 'ino_t'
> 


uint64_t vs. UINT32

So this is such a bad hack I feel bad mentioning it, but …..

In OpenSslsupport.h add #ifndef <#define in StdLib for the conflicting define>

#ifndef _SYS_TYPES_H_
typedef unsigned long  clock_t;
#endif


> 
> Any ideas ?
> 

Don’t use StdLib :) would be your other option. 

Thanks,

Andrew Fish

> 
> Saheb
> 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to