REVIEWED: extern "C" definition position for consistency

Note that `extern "C"` calling convention only affects objects that need to be seen by the linker, in our case only functions... but it would also be required by global variables exposed, if any.
This commit is contained in:
raysan5 2021-08-15 13:02:53 +02:00
parent 848cdb267a
commit aae60e1e44
4 changed files with 23 additions and 20 deletions

View File

@ -94,10 +94,6 @@
} CameraProjection;
#endif
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@ -106,6 +102,11 @@ extern "C" { // Prevents name mangling of functions
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
#if defined(CAMERA_STANDALONE)
void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available)
void UpdateCamera(Camera *camera); // Update camera position for selected mode

View File

@ -83,17 +83,16 @@
#define RAYLIB_VERSION "3.8-dev"
#ifndef RLAPI
#define RLAPI // We are building or using rlgl as a static library (or Linux shared library)
#endif
#if defined(_WIN32)
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
#if defined(BUILD_LIBTYPE_SHARED)
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
#elif defined(USE_LIBTYPE_SHARED)
#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
#else
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
#endif
//----------------------------------------------------------------------------------
@ -894,11 +893,6 @@ typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, unsigned
typedef char *(*LoadFileTextCallback)(const char *fileName); // FileIO: Load text data
typedef bool (*SaveFileTextCallback)(const char *fileName, char *text); // FileIO: Save text data
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
#endif
//------------------------------------------------------------------------------------
// Global Variables Definition
//------------------------------------------------------------------------------------
@ -908,6 +902,10 @@ extern "C" { // Prevents name mangling of functions
// Window and Graphics Device Functions (Module: core)
//------------------------------------------------------------------------------------
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
#endif
// Window-related functions
RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed

View File

@ -457,13 +457,14 @@ typedef enum {
RL_SHADER_ATTRIB_VEC4 // Shader attribute type: vec4 (4 float)
} rlShaderAttributeDataType;
//------------------------------------------------------------------------------------
// Functions Declaration - Matrix operations
//------------------------------------------------------------------------------------
#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
#endif
//------------------------------------------------------------------------------------
// Functions Declaration - Matrix operations
//------------------------------------------------------------------------------------
RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed
RLAPI void rlPushMatrix(void); // Push the current matrix to stack
RLAPI void rlPopMatrix(void); // Pop lattest inserted matrix from stack
@ -642,6 +643,7 @@ RLAPI void rlSetMatrixViewOffsetStereo(Matrix right, Matrix left); // Set e
// Quick and dirty cube/quad buffers load->draw->unload
RLAPI void rlLoadDrawCube(void); // Load and draw a cube
RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
#if defined(__cplusplus)
}
#endif

View File

@ -55,9 +55,7 @@
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
//...
//----------------------------------------------------------------------------------
// Global Variables Definition
@ -67,6 +65,10 @@ extern "C" { // Prevents name mangling of functions
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
#if defined(PLATFORM_ANDROID)
void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initialize asset manager from android app
FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only!