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