Strange issue when using ccall

pyplot
ccall
interoperability

#1

Hello everyone.

I am writing a small Julia module that call external C libraries from a third-party software package/API.
The module appears to be working correctly. However when I include other modules (
I have tested with both ProfileView and PyPlot) one of the C functions stops to work correctly

The relevant Julia code is:

    d = Float32[1]
    ret = ccall((:sf_histfloat,"libdrsf"),Bool,
                (Ptr{UInt8},Ptr{UInt8},Ptr{Cfloat}),file.rsf,"d$i",d)

I have changed the source code of the function called by sf_histfloat (that really do the work)
to print the parameters that it receives (from julia) and its results

bool sf_simtab_getfloat (sf_simtab table, const char* key,/*@out@*/ float* par)
/*< extract a float parameter from the table >*/
{
    char* val;
    double f;

    val = sf_simtab_get(table,key);
    if (NULL == val) return false;
    fprintf(stderr,"simtab_getfloat: val=%s key=%s\n",val,key);
    errno = 0;
    f = strtod(val,NULL);
    fprintf(stderr,"simtab_getfloat: val=%s f=%f\n",val, f);
    if (ERANGE == errno || f < -FLT_MAX || f > FLT_MAX) return false;
    
    *par = (float) f;
    return true;
}
bool sf_histfloat (sf_file file, const char* key,/*@out@*/ float* par) 
/*< read a float parameter from file >*/
{
    return sf_simtab_getfloat (file->pars,key,par);
}

Running the source code without including any extra modules besides the one that contain the ccall call I got this result
for the fprintf results of the previous C function:

simtab_getfloat: val=0.5 key=d1
simtab_getfloat: val=0.5 f=0.500000

That is the correct result. After including any of the modules (ProfileView or PyPlot). Just to be clear, I am only including the modules I am not calling any function from these modules.

simtab_getfloat: val=0.5 key=d1
simtab_getfloat: val=0.5 f=0,000000

I googled if the strtod function uses any environment variable. However I cannot find any reference to that. I also got problems if trying to use both modules at the same time. I got a Julia Segfault

julia --check-bounds=yes ./simple.jl <in.rsf param1=tmp.rsf >out.rsf
simtab_getfloat: val=10 key=o1
simtab_getfloat: val=10 f=10,000000
simtab_getfloat: val=0.5 key=d1
simtab_getfloat: val=0.5 f=0,000000
rsf.**
GLib:ERROR:gmain.c:3108:g_main_dispatch: assertion failed: (source)

signal (6): Aborted
while loading /home/user/scratch/julia_mad/simpleFD.jl, in expression starting on line 250
raise at /usr/src/debug/glibc-2.17-c758a686/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56
abort at /usr/src/debug/glibc-2.17-c758a686/stdlib/abort.c:90
g_assertion_message at /lib64/libglib-2.0.so.0 (unknown line)
g_assertion_message_expr at /lib64/libglib-2.0.so.0 (unknown line)
g_main_context_dispatch at /lib64/libglib-2.0.so.0 (unknown line)
unknown function (ip: 0x7f0ab279c0b7)
g_main_context_iteration at /lib64/libglib-2.0.so.0 (unknown line)
gtk_main_iteration at /lib64/libgtk-3.so.0 (unknown line)
ffi_call_unix64 at /lib64/libffi.so.6 (unknown line)
ffi_call at /lib64/libffi.so.6 (unknown line)
unknown function (ip: 0x7f0ab313a233)
unknown function (ip: 0x7f0ab313bbb7)
PyObject_Call at /usr/lib64/libpython2.7.so (unknown line)
macro expansion at /home/user/.julia/v0.6/PyCall/src/exception.jl:78 [inlined]
#_pycall#66 at /home/user/.julia/v0.6/PyCall/src/PyCall.jl:596
#pycall#69 at /home/user/.julia/v0.6/PyCall/src/PyCall.jl:615
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1424 [inlined]
jl_invoke at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:51
#1 at /home/user/.julia/v0.6/PyCall/src/gui.jl:94
#300 at ./event.jl:436
unknown function (ip: 0x7f0ad25fb93f)
jl_call_fptr_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:339 [inlined]
jl_call_method_internal at /home/centos/buildbot/slave/package_tarball64/build/src/julia_internal.h:358 [inlined]
jl_apply_generic at /home/centos/buildbot/slave/package_tarball64/build/src/gf.c:1933
jl_apply at /home/centos/buildbot/slave/package_tarball64/build/src/julia.h:1424 [inlined]
start_task at /home/centos/buildbot/slave/package_tarball64/build/src/task.c:267
unknown function (ip: 0xffffffffffffffff)
Allocations: 6516619 (Pool: 6515167; Big: 1452); GC: 13
Aborted

I am using Julia v0.6 (downloaded from the julialang website).

I know that the C function is working, even in Julia. However if include other modules I got these strange results