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