cmake config
This commit is contained in:
parent
c63b3abfc9
commit
3cf50b0771
10
CMakeLists.txt
Normal file
10
CMakeLists.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14..3.31 FATAL_ERROR)
|
||||||
|
|
||||||
|
project(Hotwire
|
||||||
|
VERSION 1
|
||||||
|
LANGUAGES C)
|
||||||
|
|
||||||
|
add_library(hotwire src/dlopen.c)
|
||||||
|
add_library(hotwire::Hotwire ALIAS hotwire)
|
||||||
|
|
||||||
|
target_include_directories(hotwire PUBLIC include)
|
42
include/dlopen.h
Normal file
42
include/dlopen.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#pragma once
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Platform specific code functions
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
void hw_platform_win32_get_last_error(LPTSTR lpszFunction);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum hotwire_status_code { Failed, Success, NoPlatform };
|
||||||
|
|
||||||
|
struct hotwire_dll_t {
|
||||||
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
|
void *dll_handle;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
HINSTANCE dll_handle;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function arguments are based off the dlopen() api on POSIX based operating
|
||||||
|
// systems Loads dll from library
|
||||||
|
struct hotwire_dll_t hw_dlopen(const char *file, int flags);
|
||||||
|
|
||||||
|
// Loads symbol from DLL
|
||||||
|
void *hw_dlsym(struct hotwire_dll_t dll, const char *symbol);
|
||||||
|
|
||||||
|
enum hotwire_status_code hw_dlclose(struct hotwire_dll_t handle);
|
Loading…
Reference in a new issue