1

My code:

public function loadFFI()
{
    FFI::load("C:\phptest\dummy.h");
}

dummy.h:

struct ffitest
{
    char test1[16];
    byte test2;
};

Error:

PHP Fatal error: Uncaught FFI\ParserException: Undefined C type "byte" at line 4

Why can I not use word or byte in this struct in PHP FFI? char, int, and short work as expected.

miken32
  • 42,008
  • 16
  • 111
  • 154
qwerty1547
  • 13
  • 3

1 Answers1

2

There is no such thing as a byte data type in standard C. Since char is already defined as a single byte, you should use that instead. If you want values 0-255 instead of -127 to 127, don't forget to make it an unsigned char.

miken32
  • 42,008
  • 16
  • 111
  • 154