Did you read my last answer?
Did you read my last answer?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
to high_flyer:
did you mean that I have to use this function "QVariant QAxBase::dynamicCall ( const char * function, QList<QVariant> & vars )"?, in my last post, I have used this function for dynamicCall() as follwing:
Qt Code:
QList<QVariant> vars5; QVariant res5; vars5 << 1 << 0.0 << 0.0 << 0.0 ; res5 = doSpot->dynamicCall(str5.toLatin1(), vars5);To copy to clipboard, switch view to plain text mode
I don't understand your meaning completely, please give me more explanation. thank for your answer.
Sorry, for some reason my brain saw 'res5' instead of 'vars5'.
So do you mean 'vars5' has only one element in the list after the call?
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
to high_flyer:
following code is the function prototype described in manual:
"short doGetMeasureDataEx(short iDev, float* x, float* y, float* p);"
the argument 0 ("iDev") is in-parameter. Arguments 1, 2 and 3("x", "y", "p") are out-parameter, two element array and pointer, so, I should get 6 values totally. these 6 values are stored in x[0], x[1], y[0], y[1], p[0], p[1].
and in my qt' test program, after calling "dynamicCall()" in my machine, the vars5 is: vars5[0] = 1, vars5[1] = -12.143, vars5[2] = -0.973, vars5[3] = 0.812. ie, vars5[0] = iDev, vars5[1] = x[0], vars5[2] = y[0], vars5[3] = p[0]. I can't get x[1], y[1], p[1] values.
the Qvariant can be used as a pointer? thank for your answer.
Ah... now I see that you didn't use the correct function signature - you have pointers as params but you were using references...
You used:
Where as the function signature is:Qt Code:
To copy to clipboard, switch view to plain text mode
So no wonder it doesn't work.Qt Code:
short doGetMeasureDataEx(short iDev, float* x, float* y, float* p);To copy to clipboard, switch view to plain text mode
What you can try, is cast the double pointer addresses to long, set that as your QVariable, and then cast back after the call:
Qt Code:
double var1 = 0.0; double var2 = 0.0; ... .. QList<QVariant> varList; varList << pDouble1 << pDouble 2.... ; res5 = doSpot->dynamicCall(str5.toLatin1(), varList ); //use the correct signature with pointers!! double *pVar = varList.at(0); var1 = *pVar;To copy to clipboard, switch view to plain text mode
I don't know if this will work, this is just something I would try.
Last edited by high_flyer; 25th July 2011 at 14:48.
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
hello:
I use dumpcpp to create a "dospotpc.h" and "dospotpc.cpp" file before: "dumpcpp {74676A0F-BB65-48A0-8044-F453692E9A8A} -o dospotpc"
In file "dospotpc.h", this function prototype is:
so, I use this code to call "dynamicCall()" function:Qt Code:
inline int doGetMeasureDataEx(int numDev, double& Xo, double& Yo, double& Po);To copy to clipboard, switch view to plain text mode
I don't know why the function argument transform from pointer type to reference type.Qt Code:
To copy to clipboard, switch view to plain text mode
it doesn't seem to work successfully. I try this and get some errors while compile.
Bookmarks