xref: /freebsd/crypto/openssl/test/simpledynamic.h (revision 96190b4fef3b4a0cc3ca0606b0c4e3e69a5e6717)
1 /*
2  * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #ifndef OSSL_TEST_SIMPLEDYNAMIC_H
11 # define OSSL_TEST_SIMPLEDYNAMIC_H
12 
13 # include "crypto/dso_conf.h"
14 
15 # if defined(DSO_DLFCN) || defined(DSO_VMS)
16 
17 #  include <dlfcn.h>
18 
19 #  define SD_INIT       NULL
20 #  ifdef DSO_VMS
21 #   define SD_SHLIB     0
22 #   define SD_MODULE    0
23 #  else
24 #   define SD_SHLIB     (RTLD_GLOBAL|RTLD_LAZY)
25 #   define SD_MODULE    (RTLD_LOCAL|RTLD_NOW)
26 #  endif
27 
28 typedef void *SD;
29 typedef void *SD_SYM;
30 
31 # elif defined(DSO_WIN32)
32 
33 #  include <windows.h>
34 
35 #  define SD_INIT       0
36 #  define SD_SHLIB      0
37 #  define SD_MODULE     0
38 
39 typedef HINSTANCE SD;
40 typedef void *SD_SYM;
41 
42 # endif
43 
44 # if defined(DSO_DLFCN) || defined(DSO_WIN32) || defined(DSO_VMS)
45 int sd_load(const char *filename, SD *sd, int type);
46 int sd_sym(SD sd, const char *symname, SD_SYM *sym);
47 int sd_close(SD lib);
48 const char *sd_error(void);
49 # endif
50 
51 #endif
52