Page 1 of 1

API : Short, Integer and Long ByAddress

Posted: Sat Aug 11, 2012 8:35 am
by Bruno FR28
Bonjour/Hello

when I declare string variable in a function of DLL, that works well. but not with numric data.
ex :
declare SQLRowCount as "SQLRowCount" of "odbc32.dll"
     SQLstmt as long
     rowcount as short byaddress
     result as short
end declare
in program :
SQLRowcount.execute, and SQLRowCount.rowcount give wrong result

but if I declare and pass the adresse it is good
ex :
declare SQLRowCount as "SQLRowCount" of "odbc32.dll"
     SQLstmt as long
     rowcount as long
     result as short
end declare

SQLRowcount.rowcount = Varptr(short_var)
SQLRowcount. execute
short_var have the good value.

What is wrong with the first form?

Merci/Thanks.
Bruno

API : Short, Integer and Long ByAddress

Posted: Mon Aug 13, 2012 3:19 pm
by Marco
hi, byaddress is only for strings, numerics are alway`s byaddress.
byaddress for strings is used by windows if a pointer to a string block is used by the dll call.

best regards

API : Short, Integer and Long ByAddress

Posted: Mon Aug 13, 2012 5:25 pm
by Bruno FR28
Bonjour, Hello

thnakyou for the answer , but i try , and i have an access violation in my program!!! with this 2 types of writing
1) I declare : rowcount as long, and use by fonction_name.rowcount=long_var
2) I declare : rowcount as long byaddress, and use by fonction_name.rowcount=long_var

message error : Access violation at adresse4DE2C43A in module "odbcjt32.dll". Write of address 000000004.

Modify le 14 Aug 2012 : 4 (the addresse of the message) is the previous value of the variable, so I think that it is the value and not the address which is giving ...

i am perplexe...

but it is not a blocking error, I use the VarPtr function to give the address, and that`s good.

au revoir/ Bye

Bruno.

API : Short, Integer and Long ByAddress

Posted: Tue Aug 14, 2012 3:41 pm
by Marco
I think this is possible, sometimes a dll function needs a variable withe an adress where it can put`s his data. And not the variable itself. I otherwords it look at the content of the variable to get the address of the other.
I hope this will help a bit.
best regards

API : Short, Integer and Long ByAddress

Posted: Sat Aug 27, 2016 7:29 am
by ClayAnderson2
excellent...thank you for sharing