Commit a6b49935 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Do not export internal symbols from shared libraries.

parent e5758e97
......@@ -77,6 +77,7 @@ REWRITE_HEADER = $(PERL) -I$(top_srcdir)/scripts \
--c-sizeof-long=$(C_SIZEOF_LONG) \
--c-sizeof-long-long=$(C_SIZEOF_LONG_LONG) \
--c-char-is-`test $(C_CHAR_IS_UNSIGNED) = 0 || echo un`signed \
-D PPM_DSO_API_EXPORT -D PPM_DSO_INTERNAL \
--dstdir=.
core/core.h: $(top_srcdir)/src/core/core.h config.h
......
......@@ -72,6 +72,7 @@ libscalesppm_la_SOURCES=ppm/scales_ppm.f90 \
core/core.h \
core/core_cf.c \
core/symprefix.h \
core/ppm_visibility.h \
core/ppm_base.f90 \
core/ppm_statistics.f90 \
core/combinatorics.h \
......
......@@ -42,9 +42,11 @@
#include "config.h"
#endif
#include "core/ppm_visibility.h"
#include "core/bsearch.h"
void *
void PPM_DSO_API_EXPORT *
PPM_bsearch_r(const void *key, const void *a, size_t nmemb, size_t size,
void *data, PPM_CompareWithData cmp)
{
......@@ -67,7 +69,7 @@ PPM_bsearch_r(const void *key, const void *a, size_t nmemb, size_t size,
return NULL;
}
void *
void PPM_DSO_API_EXPORT*
PPM_bsearch_el_r(const void *key, const void *a, size_t nmemb, size_t size,
void *data, PPM_CompareWithData cmp)
{
......
......@@ -62,7 +62,7 @@
* @param[in] cmp comparison function
* @return pointer to element of a matching key or NULL if not found
*/
void *
void PPM_DSO_API_EXPORT*
PPM_bsearch_r(const void *key, const void *a, size_t nmemb, size_t size,
void *data, PPM_CompareWithData cmp);
......@@ -81,7 +81,7 @@ PPM_bsearch_r(const void *key, const void *a, size_t nmemb, size_t size,
* @return pointer to element of a matching key or greatest element
* less than key or NULL if cmp(key, a, data) < 0
*/
void *
void PPM_DSO_API_EXPORT*
PPM_bsearch_el_r(const void *key, const void *a, size_t nmemb, size_t size,
void *data, PPM_CompareWithData cmp);
......
......@@ -45,6 +45,7 @@
#include <stddef.h>
#include <stdlib.h>
#include "core/ppm_visibility.h"
#include "cfortran.h"
#include "core/bsearch.h"
......
......@@ -63,8 +63,9 @@
#include <mpi.h>
#endif
#include "core.h"
#include "symprefix.h"
#include "core/ppm_visibility.h"
#include "core/core.h"
#include "core/symprefix.h"
MPI_Comm SymPrefix(default_comm) = MPI_COMM_WORLD;
......
......@@ -42,7 +42,12 @@
#include <config.h>
#endif
#include <stdio.h>
#include <cfortran.h>
#define FCALLSC_QUALIFIER PPM_DSO_INTERNAL
#include "cfortran.h"
#include "core/ppm_visibility.h"
#include "core.h"
static void
......@@ -113,6 +118,9 @@ abort_default_f(MPI_Fint *comm_f, const char *msg, const char *source,
SymPrefix(abort_default)(comm_c, msg, source, line);
}
#undef FCALLSC_QUALIFIER
#define FCALLSC_QUALIFIER
FCALLSCSUB4(abort_default_f,SYMPREFIX(ABORT_DEFAULT),
symprefix(abort_default),
PVOID,STRING,STRING,INT)
......
......@@ -39,10 +39,12 @@
*/
#include <assert.h>
#include <stddef.h>
#include <stdlib.h>
#include "core/fptr_api.h"
#include "core/heap.h"
#include "core/ppm_visibility.h"
#include "core/fptr_api.h"
#include "core/swapmacros.h"
static inline size_t
......@@ -66,7 +68,7 @@ parent(size_t i)
#define ep(i) ((char *)heap + (i) * es)
void
void PPM_DSO_API_EXPORT
PPM_heapify(void *heap, size_t n, size_t es, size_t i, void *data,
PPM_CompareWithData cmp)
{
......@@ -91,7 +93,7 @@ PPM_heapify(void *heap, size_t n, size_t es, size_t i, void *data,
} while(1);
}
int
int PPM_DSO_API_EXPORT
PPM_is_heap(void *heap, size_t n, size_t es, void *data,
PPM_CompareWithData cmp)
{
......@@ -103,7 +105,7 @@ PPM_is_heap(void *heap, size_t n, size_t es, void *data,
return 1;
}
void
void PPM_DSO_API_EXPORT
PPM_build_heap(void *heap, size_t n, size_t es, void *data,
PPM_CompareWithData cmp)
{
......@@ -113,7 +115,7 @@ PPM_build_heap(void *heap, size_t n, size_t es, void *data,
PPM_heapify(heap, n, es, i, data, cmp);
}
void
void PPM_DSO_API_EXPORT
PPM_heap_remove_top(void *heap, size_t n, size_t es, void *data,
PPM_CompareWithData cmp)
{
......@@ -124,7 +126,7 @@ PPM_heap_remove_top(void *heap, size_t n, size_t es, void *data,
PPM_heapify(heap, --n, es, 0, data, cmp);
}
void
void PPM_DSO_API_EXPORT
PPM_heap_elem_increase_sort(void *heap, size_t n, size_t es, size_t i,
void *data, PPM_CompareWithData cmp)
{
......@@ -141,7 +143,7 @@ PPM_heap_elem_increase_sort(void *heap, size_t n, size_t es, size_t i,
}
}
void
void PPM_DSO_API_EXPORT
PPM_heap_leaf_minimize(void *heap, size_t n, size_t es,
void *data, PPM_CompareWithData cmp)
{
......
......@@ -39,6 +39,7 @@
*/
#include <stdlib.h>
#include "cfortran.h"
#include "core/heap.h"
......
......@@ -53,8 +53,9 @@
#include "core/bittab.h"
#include "core/ppm_xfuncs.h"
#include "core/yarandom.h"
#include "core/ppm_visibility.h"
int
int PPM_DSO_API_EXPORT
PPM_prime_factorization_32(uint32_t n, uint32_t **factors)
{
uint32_t lim, i, j, p;
......@@ -184,7 +185,7 @@ PPM_permute_randomly_i4(uint32_t *a, size_t n)
}
void
void PPM_DSO_API_EXPORT
PPM_permute_randomly(void *a, size_t esize, size_t n)
{
if ((intptr_t)a % 4 == 0 && esize == 4)
......
......@@ -41,8 +41,10 @@
#include "config.h"
#endif
#include "core/ppm_visibility.h"
#define FCALLSC_QUALIFIER PPM_DSO_API_EXPORT
#include "cfortran.h"
#include "ppm_extents.h"
#include "core/ppm_extents.h"
FCALLSCSUB2(PPM_sprint_extent,
PPM_SPRINT_EXTENT, ppm_sprint_extent,
......
......@@ -47,6 +47,8 @@
#include <mpi.h>
#include "core/ppm_visibility.h"
#define FCALLSC_QUALIFIER PPM_DSO_INTERNAL
#include "cfortran.h"
#include "core/ppm_extents_mp.h"
#include "core/ppm_xfuncs.h"
......
......@@ -45,6 +45,7 @@
#include <inttypes.h>
#include <complex.h>
#include "ppm_visibility.h"
#include "ppm_math_extensions.h"
#include "cfortran.h"
#include "xpfpa_func.h"
......@@ -61,7 +62,7 @@
#endif
#endif
double complex
double complex PPM_DSO_API_EXPORT
PPM_ddp_sum_dp(size_t n, const double *a)
{
#ifdef NEED_PRECISION_CONTROL
......@@ -100,7 +101,7 @@ PPM_ddp_sum_dp_f2c(int n, const double *a, double *s)
FCALLSCSUB3(PPM_ddp_sum_dp_f2c,PPM_DDP_SUM_DP,ppm_ddp_sum_dp,
INT,DOUBLEV,DOUBLEV)
double complex
double complex PPM_DSO_API_EXPORT
PPM_ddp_add_dp_dp(double a, double b)
{
#ifdef NEED_PRECISION_CONTROL
......@@ -135,7 +136,7 @@ PPM_ddp_add_dp_dp_f2c(double a, double b, double *s)
FCALLSCSUB3(PPM_ddp_add_dp_dp_f2c,PPM_DDP_ADD_DP_DP,ppm_ddp_add_dp_dp,
DOUBLE,DOUBLE,DOUBLEV)
double complex
double complex PPM_DSO_API_EXPORT
PPM_ddp_add_ddp_ddp(double complex a, double complex b)
{
#ifdef NEED_PRECISION_CONTROL
......
......@@ -52,6 +52,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "core/ppm_visibility.h"
#define FCALLSC_QUALIFIER PPM_DSO_INTERNAL
#include "cfortran.h"
#include "core/minmax.h"
......
......@@ -47,10 +47,11 @@
#include "core/ppm_std_type_kinds_mp.h"
#include "core/ppm_xfuncs.h"
#include "cfortran.h"
#include "core/ppm_visibility.h"
#if !(MPI_VERSION > 2 || (MPI_VERSION == 2 && MPI_SUBVERSION > 1))
MPI_Datatype PPM_DT_C_DOUBLE_PAIR_MP = MPI_DATATYPE_NULL;
MPI_Datatype PPM_DT_C_DOUBLE_PAIR_MP PPM_DSO_API_EXPORT = MPI_DATATYPE_NULL;
#endif
void
......
/**
* @file ppm_visibility.h
*
* @copyright Copyright (C) 2018 Thomas Jahns <jahns@dkrz.de>
*
* @author Thomas Jahns <jahns@dkrz.de>
*/
/*
* Keywords:
* Maintainer: Thomas Jahns <jahns@dkrz.de>
* URL: https://www.dkrz.de/redmine/projects/scales-ppm
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the DKRZ GmbH nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PPM_VISIBILITY_H
#define PPM_VISIBILITY_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if (defined _WIN32 || defined __CYGWIN__) && defined __PIC__
# define PPM_DSO_API_EXPORT __declspec(dllexport)
# define PPM_DSO_INTERNAL
#else
# if (defined __GNUC__ \
&& (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 1) \
&& defined __PIC__)
# define PPM_DSO_API_EXPORT __attribute__ ((visibility ("default")))
# define PPM_DSO_INTERNAL __attribute__ ((visibility ("hidden")))
# else
# define PPM_DSO_API_EXPORT
# define PPM_DSO_INTERNAL
# endif
#endif
#endif
/*
* Local Variables:
* license-project-url: "https://www.dkrz.de/redmine/projects/scales-ppm"
* license-markup: "doxygen"
* license-default: "bsd"
* c-basic-offset: 2
* coding: utf-8
* indent-tabs-mode: nil
* show-trailing-whitespace: t
* require-trailing-newline: t
* End:
*/
......@@ -40,8 +40,11 @@
#include <stdint.h>
#include "cfortran.h"
#include "core/ppm_visibility.h"
#include "core/qsort_r_api.h"
static void
PPM_qsort_r_wrapper(void *a, int n, int es,
void *data, PPM_CompareWithData cmp)
......@@ -67,6 +70,9 @@ FCALLSCSUB5(PPM_qsort_r_mt_wrapper, PPM_QSORT_R_MT,
ppm_qsort_r_mt,
PVOID, INT, INT, PVOID, ROUTINE)
#undef FCALLSC_QUALIFIER
#define FCALLSC_QUALIFIER PPM_DSO_INTERNAL
static void
PPM_qsort_i4_f(int32_t *a, int n, PPM_CompareWithData cmp)
{
......
......@@ -66,6 +66,8 @@
#include <stdlib.h>
#include <string.h>
#include "core/ppm_visibility.h"
#include "crypto/md5.h"
static void
......
......@@ -64,6 +64,8 @@
#include <inttypes.h>
#include <stdlib.h>
#include "core/ppm_visibility.h"
enum {
PPM_MD5_BLOCK_LENGTH = 64,
PPM_MD5_DIGEST_LENGTH = 16,
......@@ -75,11 +77,11 @@ typedef struct MD5Context {
uint8_t buffer[PPM_MD5_BLOCK_LENGTH]; /* input buffer */
} PPM_MD5_CTX;
void
void PPM_DSO_INTERNAL
PPM_MD5Init(PPM_MD5_CTX *);
void
void PPM_DSO_INTERNAL
PPM_MD5Update(PPM_MD5_CTX *, const uint8_t *, size_t);
void
void PPM_DSO_INTERNAL
PPM_MD5Final(uint8_t [PPM_MD5_DIGEST_LENGTH], PPM_MD5_CTX *);
#endif /* PPM_MD5_H */
......
......@@ -51,14 +51,17 @@
#ifdef USE_CRYPTO
#include <openssl/evp.h>
#else
#include "crypto/md5.h"
#endif
#include "core/core.h"
#include "crypto/ppm_checksum.h"
void
#include "core/ppm_visibility.h"
#ifndef USE_CRYPTO
#include "crypto/md5.h"
#endif
void PPM_DSO_API_EXPORT
PPM_describe_digest(enum digest_type digest, struct PPM_digest_description *hd)
{
switch (digest)
......@@ -92,7 +95,7 @@ PPM_describe_digest(enum digest_type digest, struct PPM_digest_description *hd)
}
}
void
void PPM_DSO_API_EXPORT
PPM_checksum(const void *buf, size_t buf_size, unsigned char *checksum,
struct PPM_digest_description *digest)
{
......@@ -136,7 +139,7 @@ PPM_checksum(const void *buf, size_t buf_size, unsigned char *checksum,
}
}
void
void PPM_DSO_API_EXPORT
PPM_md2hex(char *hex, const unsigned char *checksum, size_t checksum_size)
{
size_t i;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment