Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Possibly Related Threads…
Thread Author Replies Views Last Post
  need help playing sound using certain parameters madscijr 0 401 04-01-2025, 03:52 PM
Last Post: madscijr
Question APIs from QB64PE and parameters defined As Any and unions of types ? madscijr 23 4,441 06-06-2024, 07:09 PM
Last Post: SpriggsySpriggs
Question Last 2 parameters of Locate bplus 5 1,080 01-20-2024, 08:47 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)