Skip to content

Commit

Permalink
[btls] Fixes for windows. (mono#8653)
Browse files Browse the repository at this point in the history
* [btls] Do not give gcc flags to msvc.

* [btls] #include "btls-foo.h" instead of #include <btls-foo.h> to work
with existing build system, on Windows, with out-of-tree build.
Not sure which factor does not like <> but "" should be ok.

* [blts] MONO_API is not used consistently and therefore errors on Windows.
1. Make it be nothing.
1b. Use a .def file if there are actual exports.
Really, .def files are a good idea.

 or

2. Use it consistently.

This does #1.
  • Loading branch information
jaykrell committed May 10, 2018
1 parent a7bebe7 commit baf58ed
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 57 deletions.
4 changes: 3 additions & 1 deletion mono/btls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ if (NOT "${BTLS_ARCH}" STREQUAL "")
set (CMAKE_SYSTEM_PROCESSOR "${BTLS_ARCH}")
endif ()

set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden")
if (NOT MSVC)
set (C_CXX_FLAGS "-Wall -Wsign-compare -Wmissing-field-initializers -fPIC -ggdb -fvisibility=hidden")
endif ()

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS} ${BTLS_CFLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CXX_FLAGS} ${BTLS_CFLAGS}")
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright (c) 2015 Xamarin. All rights reserved.
//

#include <btls-ssl.h>
#include <btls-bio.h>
#include "btls-ssl.h"
#include "btls-bio.h"
#include <errno.h>

struct MonoBtlsBio {
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define __btls__btls_bio__

#include <stdio.h>
#include <btls-ssl.h>
#include "btls-ssl.h"

typedef enum {
MONO_BTLS_CONTROL_COMMAND_FLUSH = 1
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-error.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-error.h>
#include <btls-util.h>
#include "btls-error.h"
#include "btls-util.h"
#include <assert.h>

MONO_API int
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-key.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-key.h>
#include "btls-key.h"

MONO_API EVP_PKEY *
mono_btls_key_new ()
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-key.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_key__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include "btls-ssl.h"
#include "btls-x509.h"

EVP_PKEY *
mono_btls_key_new ();
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-pkcs12.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-pkcs12.h>
#include "btls-pkcs12.h"
#include <openssl/pkcs12.h>

struct MonoBtlsPkcs12 {
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-pkcs12.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_pkcs12__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include "btls-ssl.h"
#include "btls-x509.h"

MonoBtlsPkcs12 *
mono_btls_pkcs12_new (void);
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-ssl-ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-ssl-ctx.h>
#include <btls-x509-verify-param.h>
#include "btls-ssl-ctx.h"
#include "btls-x509-verify-param.h"

struct MonoBtlsSslCtx {
CRYPTO_refcount_t references;
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-ssl-ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/ssl.h>
#include <btls-util.h>
#include "btls-util.h"

typedef struct MonoBtlsBio MonoBtlsBio;
typedef struct MonoBtlsX509Chain MonoBtlsX509Chain;
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright (c) 2015 Xamarin. All rights reserved.
//

#include <btls-ssl.h>
#include <btls-x509-verify-param.h>
#include "btls-ssl.h"
#include "btls-x509-verify-param.h"

struct MonoBtlsSsl {
MonoBtlsSslCtx *ctx;
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef __btls__btls_ssl__
#define __btls__btls_ssl__

#include <btls-ssl-ctx.h>
#include "btls-ssl-ctx.h"

MonoBtlsSsl *
mono_btls_ssl_new (MonoBtlsSslCtx *ctx);
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-util.h>
#include "btls-util.h"
#include <assert.h>
// #include <time.h>

Expand Down
5 changes: 4 additions & 1 deletion mono/btls/btls-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#ifndef MONO_API
#if defined(_MSC_VER)

#define MONO_API __declspec(dllexport)
// MONO_API is not used consistently and therefore errors.
// .def file is preferred.
//#define MONO_API __declspec(dllexport)
#define MONO_API /* nothing */

#else

Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-chain.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-chain.h>
#include "btls-x509-chain.h"

struct MonoBtlsX509Chain {
STACK_OF(X509) *certs;
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_x509_chain__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include "btls-ssl.h"
#include "btls-x509.h"

MonoBtlsX509Chain *
mono_btls_x509_chain_new (void);
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-crl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-crl.h>
#include <btls-x509-revoked.h>
#include "btls-x509-crl.h"
#include "btls-x509-revoked.h"

struct MonoBtlsX509Crl {
X509_CRL *crl;
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-crl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_x509_crl__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include "btls-ssl.h"
#include "btls-x509.h"

MonoBtlsX509Crl *
mono_btls_x509_crl_from_data (const void *buf, int len, MonoBtlsX509Format format);
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-lookup-mono.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-lookup.h>
#include <btls-x509-lookup-mono.h>
#include "btls-x509-lookup.h"
#include "btls-x509-lookup-mono.h"
#include <openssl/stack.h>

// random high number
Expand Down
6 changes: 3 additions & 3 deletions mono/btls/btls-x509-lookup-mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#define __btls__btls_x509_lookup_mono__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include <btls-x509-store.h>
#include "btls-ssl.h"
#include "btls-x509.h"
#include "btls-x509-store.h"

typedef int (* MonoBtlsX509LookupMono_BySubject) (const void *instance, MonoBtlsX509Name *name, X509 **ret);

Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-lookup.h>
#include <btls-x509-lookup-mono.h>
#include "btls-x509-lookup.h"
#include "btls-x509-lookup-mono.h"

struct MonoBtlsX509Lookup {
MonoBtlsX509LookupType type;
Expand Down
6 changes: 3 additions & 3 deletions mono/btls/btls-x509-lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#define __btls__btls_x509_lookup__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include <btls-x509-store.h>
#include "btls-ssl.h"
#include "btls-x509.h"
#include "btls-x509-store.h"

typedef enum {
MONO_BTLS_X509_LOOKUP_TYPE_UNKNOWN = 0,
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-name.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-name.h>
#include "btls-x509-name.h"

struct MonoBtlsX509Name {
int owns;
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-name.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define __btls__btls_x509_name__

#include <stdio.h>
#include <btls-ssl.h>
#include "btls-ssl.h"

typedef enum {
MONO_BTLS_X509_NAME_ENTRY_TYPE_UNKNOWN = 0,
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-revoked.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-revoked.h>
#include "btls-x509-revoked.h"

struct MonoBtlsX509Revoked {
MonoBtlsX509Crl *owner;
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-revoked.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_x509_revoked__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509-crl.h>
#include "btls-ssl.h"
#include "btls-x509-crl.h"

MonoBtlsX509Revoked *
mono_btls_x509_revoked_new (MonoBtlsX509Crl *owner, X509_REVOKED *revoked);
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-store-ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-store-ctx.h>
#include "btls-x509-store-ctx.h"

struct MonoBtlsX509StoreCtx {
int owns;
Expand Down
10 changes: 5 additions & 5 deletions mono/btls/btls-x509-store-ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
#define __btls__btls_x509_store_ctx__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509-chain.h>
#include <btls-x509-name.h>
#include <btls-x509-store.h>
#include <btls-x509-verify-param.h>
#include "btls-ssl.h"
#include "btls-x509-chain.h"
#include "btls-x509-name.h"
#include "btls-x509-store.h"
#include "btls-x509-verify-param.h"

MonoBtlsX509StoreCtx *
mono_btls_x509_store_ctx_from_ptr (X509_STORE_CTX *ptr);
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-store.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-store.h>
#include "btls-x509-store.h"

struct MonoBtlsX509Store {
X509_STORE *store;
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509-store.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define __btls__btls_x509_store__

#include <stdio.h>
#include <btls-ssl.h>
#include "btls-ssl.h"

MonoBtlsX509Store *
mono_btls_x509_store_new (void);
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-verify-param.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright © 2016 Xamarin. All rights reserved.
//

#include <btls-x509-verify-param.h>
#include <btls-x509-store-ctx.h>
#include "btls-x509-verify-param.h"
#include "btls-x509-store-ctx.h"

struct MonoBtlsX509VerifyParam {
int owns;
Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509-verify-param.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_x509_verify_param__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509.h>
#include "btls-ssl.h"
#include "btls-x509.h"

typedef enum {
MONO_BTLS_X509_VERIFY_FLAGS_DEFAULT = 0,
Expand Down
2 changes: 1 addition & 1 deletion mono/btls/btls-x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright (c) 2015 Xamarin. All rights reserved.
//

#include <btls-x509.h>
#include "btls-x509.h"
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>

Expand Down
4 changes: 2 additions & 2 deletions mono/btls/btls-x509.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#define __btls__btls_x509__

#include <stdio.h>
#include <btls-ssl.h>
#include <btls-x509-name.h>
#include "btls-ssl.h"
#include "btls-x509-name.h"

typedef enum {
MONO_BTLS_X509_FORMAT_DER = 1,
Expand Down

0 comments on commit baf58ed

Please sign in to comment.