Skip to content

Commit

Permalink
Add support for dll
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Nov 6, 2016
1 parent 007526f commit d6f9129
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 29 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (MSVC)

foreach(CompilerFlag CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE)
if (BUILD_SHARED_LIBS)
set(${CompilerFlag} "${${CompilerFlag}} /DMSC_USE_DLL /DARB_BUILD_DLL /DPTW32_BUILD")
set(${CompilerFlag} "${${CompilerFlag}} /DMSC_USE_DLL /DARB_BUILD_DLL /DPTW32_BUILD /DFLINT_REENTRANT=0 /DHAVE_TLS=1")
else ()
set(${CompilerFlag} "${${CompilerFlag}} /DPTW32_STATIC_LIB")
endif()
Expand Down Expand Up @@ -107,8 +107,8 @@ include_directories(BEFORE ${arb_SOURCE_DIR})
include_directories(BEFORE ${DEP_INCLUDE_DIRS})

add_library(arb ${SRC})

target_link_libraries(arb ${DEPS})
target_compile_definitions(arb PUBLIC "ARB_BUILD_DLL")

if(NOT MSVC)
target_link_libraries(arb m)
Expand Down
2 changes: 1 addition & 1 deletion acb_poly/exp_series.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "acb_poly.h"

/* allow changing this from the test code */
slong acb_poly_newton_exp_cutoff = 120;
ARB_DLL slong acb_poly_newton_exp_cutoff = 120;

/* with inverse=1 simultaneously computes g = exp(-x) to length n
with inverse=0 uses g as scratch space, computing
Expand Down
34 changes: 17 additions & 17 deletions arb.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
extern "C" {
#endif

extern const char * arb_version;
ARB_DLL extern const char * arb_version;
double arb_test_multiplier(void);

typedef struct
Expand Down Expand Up @@ -993,10 +993,10 @@ _arb_vec_get_unique_fmpz_vec(fmpz * res, arb_srcptr vec, slong len)
#define ARB_ATAN_TAB2_PREC 4608
#define ARB_ATAN_TAB2_LIMBS (ARB_ATAN_TAB2_PREC / FLINT_BITS)

extern const mp_limb_t arb_atan_tab1[1 << ARB_ATAN_TAB1_BITS][ARB_ATAN_TAB1_LIMBS];
extern const mp_limb_t arb_atan_tab21[1 << ARB_ATAN_TAB21_BITS][ARB_ATAN_TAB2_LIMBS];
extern const mp_limb_t arb_atan_tab22[1 << ARB_ATAN_TAB22_BITS][ARB_ATAN_TAB2_LIMBS];
extern const mp_limb_t arb_atan_pi2_minus_one[ARB_ATAN_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_atan_tab1[1 << ARB_ATAN_TAB1_BITS][ARB_ATAN_TAB1_LIMBS];
ARB_DLL extern const mp_limb_t arb_atan_tab21[1 << ARB_ATAN_TAB21_BITS][ARB_ATAN_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_atan_tab22[1 << ARB_ATAN_TAB22_BITS][ARB_ATAN_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_atan_pi2_minus_one[ARB_ATAN_TAB2_LIMBS];

void
_arb_atan_taylor_naive(mp_ptr y, mp_limb_t * error,
Expand All @@ -1017,11 +1017,11 @@ void _arb_atan_taylor_rs(mp_ptr y, mp_limb_t * error,
#define ARB_LOG_TAB2_PREC 4608
#define ARB_LOG_TAB2_LIMBS (ARB_LOG_TAB2_PREC / FLINT_BITS)

extern const mp_limb_t arb_log_tab11[1 << ARB_LOG_TAB11_BITS][ARB_LOG_TAB1_LIMBS];
extern const mp_limb_t arb_log_tab12[1 << ARB_LOG_TAB12_BITS][ARB_LOG_TAB1_LIMBS];
extern const mp_limb_t arb_log_tab21[1 << ARB_LOG_TAB21_BITS][ARB_LOG_TAB2_LIMBS];
extern const mp_limb_t arb_log_tab22[1 << ARB_LOG_TAB22_BITS][ARB_LOG_TAB2_LIMBS];
extern const mp_limb_t arb_log_log2_tab[ARB_LOG_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_log_tab11[1 << ARB_LOG_TAB11_BITS][ARB_LOG_TAB1_LIMBS];
ARB_DLL extern const mp_limb_t arb_log_tab12[1 << ARB_LOG_TAB12_BITS][ARB_LOG_TAB1_LIMBS];
ARB_DLL extern const mp_limb_t arb_log_tab21[1 << ARB_LOG_TAB21_BITS][ARB_LOG_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_log_tab22[1 << ARB_LOG_TAB22_BITS][ARB_LOG_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_log_log2_tab[ARB_LOG_TAB2_LIMBS];

/* exponential implementation */

Expand All @@ -1039,9 +1039,9 @@ extern const mp_limb_t arb_log_log2_tab[ARB_LOG_TAB2_LIMBS];
#define ARB_EXP_TAB2_PREC 4608
#define ARB_EXP_TAB2_LIMBS (ARB_EXP_TAB2_PREC / FLINT_BITS)

extern const mp_limb_t arb_exp_tab1[ARB_EXP_TAB1_NUM][ARB_EXP_TAB1_LIMBS];
extern const mp_limb_t arb_exp_tab21[ARB_EXP_TAB21_NUM][ARB_EXP_TAB2_LIMBS];
extern const mp_limb_t arb_exp_tab22[ARB_EXP_TAB22_NUM][ARB_EXP_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_exp_tab1[ARB_EXP_TAB1_NUM][ARB_EXP_TAB1_LIMBS];
ARB_DLL extern const mp_limb_t arb_exp_tab21[ARB_EXP_TAB21_NUM][ARB_EXP_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_exp_tab22[ARB_EXP_TAB22_NUM][ARB_EXP_TAB2_LIMBS];

void _arb_exp_taylor_naive(mp_ptr y, mp_limb_t * error,
mp_srcptr x, mp_size_t xn, ulong N);
Expand Down Expand Up @@ -1078,12 +1078,12 @@ void _arb_exp_sum_bs_simple(fmpz_t T, fmpz_t Q, mp_bitcnt_t * Qexp,
#define ARB_SIN_COS_TAB2_PREC 4608
#define ARB_SIN_COS_TAB2_LIMBS (ARB_SIN_COS_TAB2_PREC / FLINT_BITS)

extern const mp_limb_t arb_sin_cos_tab1[2 * ARB_SIN_COS_TAB1_NUM][ARB_SIN_COS_TAB1_LIMBS];
extern const mp_limb_t arb_sin_cos_tab21[2 * ARB_SIN_COS_TAB21_NUM][ARB_SIN_COS_TAB2_LIMBS];
extern const mp_limb_t arb_sin_cos_tab22[2 * ARB_SIN_COS_TAB22_NUM][ARB_SIN_COS_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_sin_cos_tab1[2 * ARB_SIN_COS_TAB1_NUM][ARB_SIN_COS_TAB1_LIMBS];
ARB_DLL extern const mp_limb_t arb_sin_cos_tab21[2 * ARB_SIN_COS_TAB21_NUM][ARB_SIN_COS_TAB2_LIMBS];
ARB_DLL extern const mp_limb_t arb_sin_cos_tab22[2 * ARB_SIN_COS_TAB22_NUM][ARB_SIN_COS_TAB2_LIMBS];

#define ARB_PI4_TAB_LIMBS (4608 / FLINT_BITS)
extern const mp_limb_t arb_pi4_tab[ARB_PI4_TAB_LIMBS];
ARB_DLL extern const mp_limb_t arb_pi4_tab[ARB_PI4_TAB_LIMBS];

void _arb_sin_cos_taylor_naive(mp_ptr ysin, mp_ptr ycos, mp_limb_t * error,
mp_srcptr x, mp_size_t xn, ulong N);
Expand Down
8 changes: 4 additions & 4 deletions arb/exp_taylor_rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#if FLINT_BITS == 64

const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
ARB_DLL const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
UWORD(2432902008176640000),
UWORD(2432902008176640000),
UWORD(1216451004088320000),
Expand Down Expand Up @@ -311,7 +311,7 @@ const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
UWORD(1),
};

const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE] = {
ARB_DLL const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE] = {
UWORD(2432902008176640000),
UWORD(2432902008176640000),
UWORD(2432902008176640000),
Expand Down Expand Up @@ -604,7 +604,7 @@ const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE] = {

#else

const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
ARB_DLL const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
UWORD(479001600),
UWORD(479001600),
UWORD(239500800),
Expand Down Expand Up @@ -895,7 +895,7 @@ const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE] = {
UWORD(288),
};

const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE] = {
ARB_DLL const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE] = {
UWORD(479001600),
UWORD(479001600),
UWORD(479001600),
Expand Down
4 changes: 2 additions & 2 deletions arb/sin_cos_taylor_rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#define FACTORIAL_TAB_SIZE 288

extern const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE];
extern const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE];
ARB_DLL extern const mp_limb_t factorial_tab_numer[FACTORIAL_TAB_SIZE];
ARB_DLL extern const mp_limb_t factorial_tab_denom[FACTORIAL_TAB_SIZE];

void _arb_sin_cos_taylor_rs(mp_ptr ysin, mp_ptr ycos,
mp_limb_t * error, mp_srcptr x, mp_size_t xn, ulong N,
Expand Down
2 changes: 1 addition & 1 deletion arb_poly/test/t-exp_series.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "arb_poly.h"

extern slong arb_poly_newton_exp_cutoff;
ARB_DLL extern slong arb_poly_newton_exp_cutoff;

int main()
{
Expand Down
4 changes: 2 additions & 2 deletions arf.h
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ void arf_randtest_special(arf_t x, flint_rand_t state, slong bits, slong mag_bit
extern TLS_PREFIX mp_ptr __arf_mul_tmp;
extern TLS_PREFIX slong __arf_mul_alloc;

extern void _arf_mul_tmp_cleanup(void);
ARB_DLL extern void _arf_mul_tmp_cleanup(void);

#define ARF_MUL_TMP_DECL \
mp_limb_t tmp_stack[ARF_MUL_STACK_ALLOC]; \
Expand Down Expand Up @@ -957,7 +957,7 @@ arf_mul_fmpz(arf_ptr z, arf_srcptr x, const fmpz_t y, slong prec, arf_rnd_t rnd)
extern TLS_PREFIX mp_ptr __arf_add_tmp;
extern TLS_PREFIX slong __arf_add_alloc;

extern void _arf_add_tmp_cleanup(void);
ARB_DLL extern void _arf_add_tmp_cleanup(void);

#define ARF_ADD_TMP_DECL \
mp_limb_t tmp_stack[ARF_ADD_STACK_ALLOC]; \
Expand Down
6 changes: 6 additions & 0 deletions fmpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@

#define TLS_PREFIX FLINT_TLS_PREFIX

#if defined(_MSC_VER) && defined(ARB_BUILD_DLL)
#define ARB_DLL __declspec(dllexport)
#else
#define ARB_DLL FLINT_DLL
#endif

#define fmpr_rnd_t int
#define FMPR_RND_DOWN 0
#define FMPR_RND_UP 1
Expand Down

0 comments on commit d6f9129

Please sign in to comment.