{
    "mode": "ri",
    "parameter": "FFI::Generator",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/ri/FFI%3A%3AGenerator/json",
    "generated": "2026-07-30T20:45:04Z",
    "sections": {
        "FFI::Generator < Object": {
            "content": "(from /home/chedong/.local/share/rdoc)\n------------------------------------------------------------------------\nGenerate files with C structs for FFI::Struct and C constants.\n",
            "subsections": [
                {
                    "name": "A simple example",
                    "content": "In file zlib.rb.ffi:\nmodule Zlib\n@@@\nconstants do |c|\nc.include \"zlib.h\"\nc.const :ZLIBVERNUM\nend\n@@@\n\nclass ZStream < FFI::Struct\n\nstruct do |s|\ns.name \"struct zstreams\"\ns.include \"zlib.h\"\n\ns.field :nextin,   :pointer\ns.field :availin,  :uint\ns.field :totalin,  :ulong\nend\n@@@\nend\nend\n\nTranslate the file:\nrequire \"ffi/tools/generator\"\nFFI::Generator.new \"zlib.rb.ffi\", \"zlib.rb\"\n\nGenerates the file zlib.rb with constant values and offsets:\nmodule Zlib\nZLIBVERNUM = 4784\n\nclass ZStream < FFI::Struct\nlayout :nextin, :pointer, 0,\n:availin, :uint, 8,\n:totalin, :ulong, 16\nend\n\n@see FFI::Generator::Task for easy integration in a Rakefile\n------------------------------------------------------------------------"
                }
            ]
        },
        "Class methods:": {
            "content": "new\n",
            "subsections": []
        },
        "Instance methods:": {
            "content": "constants\nstruct\ntos\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}