PHP code example of serafim / ffi-ide-helper

1. Go to this page and download the library: Download serafim/ffi-ide-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

serafim / ffi-ide-helper example snippets


// Example C/C++ header declaration:
//
// typedef struct MyExampleStruct { ... } MyExampleStruct;
// extern void foo(MyExampleStruct* a);
// extern void foo(MyExampleStruct** b);
// 

return [
    'out'   => __DIR__ . '/resources/stubs',
    'types' => [
        'MyExampleStruct' => ['pointers' => 2],
    //  ^^^^^^^^^^^^^^^^                   ^ - Number of pointers.
    //  Your Class Name                        Number 2 means that will be created
    //                                         "MyExampleStructPtr" and "MyExampleStructPtrPtr" pointers
    ],
];
sh
$ vendor/bin/ffi-generator.php ffi-gen-config.php