Skip to content

Commit adb2056

Browse files
committed
Review shared library building
1 parent 07f3a65 commit adb2056

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
214214
endif
215215

216216
# Define default C compiler and archiver to pack library
217-
CC ?= gcc
217+
CC = gcc
218218
AR = ar
219219

220220
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@@ -484,7 +484,7 @@ else
484484
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
485485
ifeq ($(PLATFORM_OS),WINDOWS)
486486
# TODO: Compile resource file raylib.dll.rc for linkage on raylib.dll generation
487-
$(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
487+
$(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
488488
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!"
489489
endif
490490
ifeq ($(PLATFORM_OS),LINUX)

src/raylib.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@
7676

7777
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
7878

79-
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
80-
8179
#if defined(_WIN32)
8280
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
8381
#if defined(BUILD_LIBTYPE_SHARED)
8482
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
8583
#elif defined(USE_LIBTYPE_SHARED)
8684
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
85+
#else
86+
#define RLAPI // We are building or using raylib as a static library
8787
#endif
88+
#else
89+
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
8890
#endif
8991

9092
//----------------------------------------------------------------------------------

0 commit comments

Comments
 (0)