I have a library "libqscr.so", that I load into my program during the runtime using dlopen. It was working perfectly, after I rebooted my PC, dlopen started giving me this error:
*** Error in `/path/to/program': realloc(): invalid pointer: 0xbfffef5c ***
I've tried recompiling the library, but the problem remains. I've noticed that it only occurs when the path is correct, otherwise, null is returned. BTW, I'm running all this on Ubuntu 14.04.
EDIT: I noticed that this issue only happens with that specific library, others load fine.
EDIT2: So I've tracked the issue to the library, and even the function which is causing it. I've noticed that if I removed the setLength function, everything starts working fine:
alias Tqarray = Tqvar[];
Tqarray[string] vals;
struct Tqvar{
string s;
double d;
bool ii = true;
}
Tqvar setLength(Tqlist args){
Tqvar r = args.read(0);
vals[r.s].length=to!uint(trunc(args.read(1).d));
return r;
}
Any ideas why this is happening?
Yet another EDIT(3): I removed the trunc function call, and it is all working now. Any answer explaining why it is happening, I'll accept.