Review shared library building

This commit is contained in:
raysan5 2020-04-01 11:06:05 +02:00
parent 07f3a65a96
commit adb20569be
2 changed files with 6 additions and 4 deletions

View file

@ -214,7 +214,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif endif
# Define default C compiler and archiver to pack library # Define default C compiler and archiver to pack library
CC ?= gcc CC = gcc
AR = ar AR = ar
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@ -484,7 +484,7 @@ else
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# TODO: Compile resource file raylib.dll.rc for linkage on raylib.dll generation # TODO: Compile resource file raylib.dll.rc for linkage on raylib.dll generation
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(RAYLIB_RELEASE_PATH)/raylib.dll.rc.data -L$(RAYLIB_RELEASE_PATH) -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylib.dll.a
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!"
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)

View file

@ -76,15 +76,17 @@
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback #include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#if defined(_WIN32) #if defined(_WIN32)
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll // Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
#if defined(BUILD_LIBTYPE_SHARED) #if defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll) #define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
#elif defined(USE_LIBTYPE_SHARED) #elif defined(USE_LIBTYPE_SHARED)
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll) #define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
#else
#define RLAPI // We are building or using raylib as a static library
#endif #endif
#else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif #endif
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------