Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C-Library and STRING-Parameters
#2
To pass a string to a function in C you have it take a `char *` parameter. In concept this is similar to a by-ref pass in QB64, you're given a pointer to the string contents rather than a copy of the string contents. A `String` parameter in `Declare Library` is the same, a by-ref pass will pass the `String` as a `char *` to the C function. Note that C is expecting the string to be NUL terminated, QB64 string's are not so you'll have to add the NUL yourself.

You're not allowed to pass a char array by-value to a C function, so as a consequence you can't pass a `String` by-value to a C function either.
Reply


Messages In This Thread
C-Library and STRING-Parameters - by BSpinoza - 09-07-2023, 10:42 AM
RE: C-Library and STRING-Parameters - by DSMan195276 - 09-07-2023, 10:52 AM
RE: C-Library and STRING-Parameters - by RhoSigma - 09-07-2023, 03:47 PM
RE: C-Library and STRING-Parameters - by BSpinoza - 09-08-2023, 03:34 AM



Users browsing this thread: 1 Guest(s)