API : Short, Integer and Long ByAddress

Here one can report bugs or hold discussions about bugs updates and work arounds.
Post Reply
Bruno FR28
Posts: 11
Joined: Fri Aug 10, 2012 6:45 am

API : Short, Integer and Long ByAddress

Post: # 939Post Bruno FR28
Sat Aug 11, 2012 8:35 am

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

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

API : Short, Integer and Long ByAddress

Post: # 940Post Marco
Mon Aug 13, 2012 3:19 pm

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

Bruno FR28
Posts: 11
Joined: Fri Aug 10, 2012 6:45 am

API : Short, Integer and Long ByAddress

Post: # 941Post Bruno FR28
Mon Aug 13, 2012 5:25 pm

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.

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

API : Short, Integer and Long ByAddress

Post: # 942Post Marco
Tue Aug 14, 2012 3:41 pm

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

ClayAnderson2
Posts: 3
Joined: Sat Aug 27, 2016 7:16 am

API : Short, Integer and Long ByAddress

Post: # 943Post ClayAnderson2
Sat Aug 27, 2016 7:29 am

excellent...thank you for sharing

Post Reply