mirror of
https://github.com/yasm/yasm
synced 2026-08-26 22:26:05 -04:00
Fix detecting Windows platform (#204)
This replaces _MSC_VER macro with _WIN32 because the former one is for MSVC and Visual Studio only and is not defined in mingw environment. Wherease, _WIN32 macro is the proper way to check Windows platform irrespective of compiler toolchain. See the following official link for more info https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros
This commit is contained in:
parent
05a52bab75
commit
a277a590f0
5 changed files with 9 additions and 9 deletions
|
|
@ -31,7 +31,7 @@
|
|||
#include "libyasm-stdint.h"
|
||||
#include "yasm-plugin.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(__GNUC__)
|
||||
#include <dlfcn.h>
|
||||
|
|
@ -43,7 +43,7 @@ static int num_loaded_plugins = 0;
|
|||
static void *
|
||||
load_dll(const char *name)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
return LoadLibrary(name);
|
||||
#elif defined(__GNUC__)
|
||||
return dlopen(name, RTLD_NOW);
|
||||
|
|
@ -62,7 +62,7 @@ load_plugin(const char *name)
|
|||
/* Load library */
|
||||
|
||||
path = yasm_xmalloc(strlen(name)+10);
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
strcpy(path, name);
|
||||
strcat(path, ".dll");
|
||||
lib = load_dll(path);
|
||||
|
|
@ -92,7 +92,7 @@ load_plugin(const char *name)
|
|||
|
||||
/* Get yasm_init_plugin() function and run it */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
init_plugin =
|
||||
(void (*)(void))GetProcAddress((HINSTANCE)lib, "yasm_init_plugin");
|
||||
#elif defined(__GNUC__)
|
||||
|
|
@ -115,7 +115,7 @@ unload_plugins(void)
|
|||
return;
|
||||
|
||||
for (i = 0; i < num_loaded_plugins; i++) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
FreeLibrary((HINSTANCE)loaded_plugins[i]);
|
||||
#elif defined(__GNUC__)
|
||||
dlclose(loaded_plugins[i]);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ typedef unsigned long uintptr_t;
|
|||
#endif
|
||||
|
||||
#ifndef YASM_LIB_DECL
|
||||
# if defined(BUILD_SHARED_LIBS) && defined(_MSC_VER)
|
||||
# if defined(BUILD_SHARED_LIBS) && defined(_WIN32)
|
||||
# ifdef YASM_LIB_SOURCE
|
||||
# define YASM_LIB_DECL __declspec(dllexport)
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ IF(regen_init_plugin_c)
|
|||
"extern yasm_${_type}_module yasm_${_keyword}_LTX_${_type};\n")
|
||||
ENDFOREACH(module)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _MSC_VER\n")
|
||||
FILE(APPEND ${INIT_PLUGIN_C} "\n#ifdef _WIN32\n")
|
||||
FILE(APPEND ${INIT_PLUGIN_C} "__declspec(dllexport)\n")
|
||||
FILE(APPEND ${INIT_PLUGIN_C} "#endif\n")
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern yasm_arch_module yasm_dbg_LTX_objfmt;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
void
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern yasm_arch_module yasm_x86_LTX_arch;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue