how to pass parameters to H file?
#6
Declare Library "plus"
    Function calc_plus% (a As Integer, b As Integer)
End Declare


In the above, QB64 will attempt to pass the _OFFSETs of the two parameters for you, and I don't think that's what you're looking for.   To pass the value of those Integers, use BYVAL as Jack as suggested above.

Declare Library "plus"
    Function calc_plus% (BYVAL a As Integer, BYVAL b As Integer)
End Declare




Point 2 that you might try is to DECLARE DYNAMIC LIBRARY or DECLARE CUSTOMTYPE LIBRARY and see if that corrects the issue.  You're trying to send and receive INTEGER values (16-bit) and the C-code you've written is actually looking to use 32-bit LONG values.  DECLARE DYNAMIC and DECLARE CUSTOMTYPE aren't as particular about 100% type matching, so swapping to those might solve the issue for you.  I'll test exactly what all is needed later, when I get back home from physical therapy and give you a 100% working example then.  Wink
Reply


Messages In This Thread
how to pass parameters to H file? - by Petr - 04-11-2023, 03:30 PM
RE: how to pass parameters to H file? - by Jack - 04-11-2023, 03:50 PM
RE: how to pass parameters to H file? - by Jack - 04-11-2023, 03:54 PM
RE: how to pass parameters to H file? - by Petr - 04-11-2023, 04:59 PM
RE: how to pass parameters to H file? - by Jack - 04-11-2023, 05:09 PM
RE: how to pass parameters to H file? - by SMcNeill - 04-11-2023, 05:16 PM
RE: how to pass parameters to H file? - by Jack - 04-11-2023, 05:17 PM
RE: how to pass parameters to H file? - by Petr - 04-11-2023, 05:31 PM



Users browsing this thread: 4 Guest(s)