Add support for dll

This commit is contained in:
Isuru Fernando 2016-11-06 22:01:21 +05:30
parent 007526fd4c
commit d6f9129951
8 changed files with 35 additions and 29 deletions

View file

@ -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()
@ -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)

View file

@ -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

34
arb.h
View file

@ -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
@ -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,
@ -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 */
@ -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);
@ -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);

View file

@ -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),
@ -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),
@ -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),
@ -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),

View file

@ -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,

View file

@ -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()
{

4
arf.h
View file

@ -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]; \
@ -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]; \

6
fmpr.h
View file

@ -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