Skip to content

Commit

Permalink
Add symbol visibility information to all the functions that are exported
Browse files Browse the repository at this point in the history
  • Loading branch information
imciner2 committed Mar 13, 2021
1 parent a00d500 commit d9affae
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 36 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ set(
# ----------------------------------------------
add_library (qdldlobject OBJECT ${qdldl_src} ${qdldl_headers})
target_include_directories(qdldlobject PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_compile_definitions(qdldlobject PUBLIC BUILDING_QDLDL)


# Create Static Library
Expand All @@ -116,6 +117,7 @@ include(GNUInstallDirs)
add_library (qdldlstatic STATIC ${qdldl_src} ${qdldl_headers})
# Give same name to static library output
set_target_properties(qdldlstatic PROPERTIES OUTPUT_NAME qdldl)
target_compile_definitions(qdldlstatic PUBLIC BUILDING_QDLDL)

# Declare include directories for the cmake exported target
target_include_directories(qdldlstatic
Expand All @@ -141,6 +143,7 @@ install(FILES ${qdldl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/qdldl")
# ----------------------------------------------
# Create qdldl shared library
add_library (qdldl SHARED ${qdldl_src} ${qdldl_headers})
target_compile_definitions(qdldl PUBLIC BUILDING_QDLDL)

# Declare include directories for the cmake exported target
target_include_directories(qdldl
Expand Down
88 changes: 52 additions & 36 deletions include/qdldl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
#include "qdldl_types.h"
#include "qdldl_version.h"

// Define the function attributes that are needed to mark functions as being
// visible for linking in the shared library version of QDLDL
#if defined(_WIN32)
# if defined(BUILDING_QDLDL)
# define QDLDL_API_EXPORT __declspec(dllexport)
# else
# define QDLDL_API_EXPORT __declspec(dllimport)
# endif
#else
# if defined(BUILDING_QDLDL)
# define QDLDL_API_EXPORT __attribute__((visibility("default")))
# else
# define QDLDL_API_EXPORT
# endif
#endif

# ifdef __cplusplus
extern "C" {
# endif // ifdef __cplusplus
Expand Down Expand Up @@ -44,12 +60,12 @@ extern "C" {
* Returns -2 if the return value overflows QDLDL_int.
*
*/
QDLDL_int QDLDL_etree(const QDLDL_int n,
const QDLDL_int* Ap,
const QDLDL_int* Ai,
QDLDL_int* work,
QDLDL_int* Lnz,
QDLDL_int* etree);
QDLDL_API_EXPORT QDLDL_int QDLDL_etree(const QDLDL_int n,
const QDLDL_int* Ap,
const QDLDL_int* Ai,
QDLDL_int* work,
QDLDL_int* Lnz,
QDLDL_int* etree);


/**
Expand Down Expand Up @@ -86,20 +102,20 @@ extern "C" {
* or otherwise LDL factorisable)
*
*/
QDLDL_int QDLDL_factor(const QDLDL_int n,
const QDLDL_int* Ap,
const QDLDL_int* Ai,
const QDLDL_float* Ax,
QDLDL_int* Lp,
QDLDL_int* Li,
QDLDL_float* Lx,
QDLDL_float* D,
QDLDL_float* Dinv,
const QDLDL_int* Lnz,
const QDLDL_int* etree,
QDLDL_bool* bwork,
QDLDL_int* iwork,
QDLDL_float* fwork);
QDLDL_API_EXPORT QDLDL_int QDLDL_factor(const QDLDL_int n,
const QDLDL_int* Ap,
const QDLDL_int* Ai,
const QDLDL_float* Ax,
QDLDL_int* Lp,
QDLDL_int* Li,
QDLDL_float* Lx,
QDLDL_float* D,
QDLDL_float* Dinv,
const QDLDL_int* Lnz,
const QDLDL_int* etree,
QDLDL_bool* bwork,
QDLDL_int* iwork,
QDLDL_float* fwork);


/**
Expand All @@ -116,12 +132,12 @@ QDLDL_int QDLDL_factor(const QDLDL_int n,
* @param x initialized to b. Equal to x on return
*
*/
void QDLDL_solve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
const QDLDL_float* Dinv,
QDLDL_float* x);
QDLDL_API_EXPORT void QDLDL_solve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
const QDLDL_float* Dinv,
QDLDL_float* x);


/**
Expand All @@ -137,11 +153,11 @@ void QDLDL_solve(const QDLDL_int n,
* @param x initialized to b. Equal to x on return
*
*/
void QDLDL_Lsolve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
QDLDL_float* x);
QDLDL_API_EXPORT void QDLDL_Lsolve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
QDLDL_float* x);


/**
Expand All @@ -157,11 +173,11 @@ void QDLDL_Lsolve(const QDLDL_int n,
* @param x initialized to b. Equal to x on return
*
*/
void QDLDL_Ltsolve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
QDLDL_float* x);
QDLDL_API_EXPORT void QDLDL_Ltsolve(const QDLDL_int n,
const QDLDL_int* Lp,
const QDLDL_int* Li,
const QDLDL_float* Lx,
QDLDL_float* x);

# ifdef __cplusplus
}
Expand Down

0 comments on commit d9affae

Please sign in to comment.