Hello everybody,
I’m a little bit frustrated with Xojo. My recent problem is the following:
I’m overloading functions to simplify stuff eg:
fun(int, int)
fun(myType, int)
...
This works well and Xojo can differentiate between those functions - So the linker takes the arguments in the account.
Now, I have a function, which is changing objects, as well as intrinsic data types. So I really would like to write something like
fun(ByRef int, ByRef int)
fun(myType, ByRef int)
Now, in my case I’m using either string or int (which shall become a pointer/reference) and I get the message, that there is more than one item with this name…
So: Is the Linker in Xojo only distinguish between objects, intrinsic data-types and pointers(References)? - But this wouldn’t make any sense, because objects and my pointers/References are both pointers/references…
Or is Xojo trying to convert mit Pointer(Int) to some String?
Here is a more real defined code:
//function definitions:
assign (ByRef new_val As Integer, cur_record As RecordSet, cur_field_name as String) integer (...)
...
assign (new_val As String, cur_record As RecordSet, cur_field_name as String) integer (...)
...
//function calls
if assign(tmp_log_entry.id, cur_record, sql.id.name) <> 0 then return -1 // int value in tmp_log_entry.id
if assign(tmp_log_entry.name, cur_record, sql.name.name) <> 0 then return -1 // string value in tmp_log_entry.name
Thannks
Hans Jochen
Edit:
I observed the following, strange behaviour:
This works, when running my code with:
Dim tmp_int As Integer = 0
if assign(tmp_integer, cur_record, sql.id.name) <> 0 then return -1 // int value in tmp_log_entry.id
It must be
Now, when I create a seperate class, only for the integer pointers:
assign_int (ByRef new_val As Integer, cur_record As RecordSet, cur_field_name as String) integer (...)
,
and call it with my original class-entries I get an error:“you cant pass an expression as a parameter that is defined as byref”.
So…I did not want to pass an expression, and I’m not clear, what Xojo is doing here.
My class ist more like an public structure, an tmp_log_entry.id is a simple Int.
Where are my thoughts wrong?