I have strange issue. When I invoking imported method with arguments from shared library, in those method I have wrong arguments. It's like:
x = 1; y = 2; z = 3;
(*method)(x,y,z);
In method I have:
void method(int x, int y, int z){
// x = 2, y = 3, z = 32432423 - something like this
}
Here how I do import:
QVector<int> (*interpolateValue)( int, int, int );
libHandle = dlopen( "plugins/libinterpolate.so", RTLD_LAZY );
*(void **)(&interpolateValue) = dlsym( libHandle, "_ZN11Interpolate16interpolateValueEiii" );
QVector<int> ys = (*interpolateValue)( lastY, newY, step );
I made work around about this in such way:
QVector<int> (*interpolateValue)( int*, int, int, int );
QVector<int> ys = (*interpolateValue)( NULL, lastY, newY, step );
But i think it's not a means.
c++filt(1)
says:which seems to indicate that the function you're trying to call is a member function of a C++ class. That means it has an implicit first parameter - the
this
pointer. Your workaround fixes things because you're passing aNULL
this
pointer for the method to use. Apparently it does not, in fact, use that parameter at all, though..If you don't want to have to work around the problem in this way, change
Interpolate::interpolateValue(int, int, int)
to be a free function instead of a method of whatever class it's in.