Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmp print functions don't print in xeus cling #508

Open
FeelUsM opened this issue Dec 18, 2023 · 0 comments
Open

gmp print functions don't print in xeus cling #508

FeelUsM opened this issue Dec 18, 2023 · 0 comments

Comments

@FeelUsM
Copy link

FeelUsM commented Dec 18, 2023

I run next con in xeus-cling:

#pragma cling load("libgmp.so")
#include <gmp.h>
    mpz_t n;
    int l;
    
    mpz_init(n);
    mpz_set_ui(n,1);
    
    mpz_add_ui(n,n,1);
    
    fprintf(stdout,"n = ");
    l = mpz_out_str(stdout,10,n); // stdout stay unchanged here
    fprintf (stdout,"; (%d)\n",l);

    l = gmp_printf("n = %Zd", n) ; // stdout stay unchanged here
    fprintf (stdout,"; (%d)\n",l);

    char buf[1024];
    l = gmp_sprintf(buf,"%Zd",n);
    printf ("n = %s; (%d)\n",buf,l);

    printf("%s\n",gmp_version);

and it print

n = ; (1)
; (5)
n = 2; (1)
6.2.1

The same code compiled by gcc prints OK:

n = 2; (1)
n = 2; (5)
n = 2; (1)
6.2.1

I assume it because it use different libraries
xeus 3.1.4 h06414e2_0 conda-forge, xeus-cling 0.15.3 he80cb83_2 conda-forge:
/home/username/miniforge3/envs/cling/include/gmp.h /home/username/miniforge3/envs/cling/lib/libgmp.so
gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6): /usr/include/gmp.h /lib64/libgmp.so
but it don't solve the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant