Gtk binding

I understand it is a work in progress but I try to run crystal docs in the main directory of :


But this fails.
What i need in fact is a list of all available functions and parameters.
Something like the equivalent of a C header file or Java interface
Can this be generated out of the source code ?

Let me quote the readme :slight_smile:

There’s a very work in progress documentation generator under the gi-doc target. Note it is a modified version of the Crystal compiler’s doc generator and thus compiles almost the entire compiler, thus compiling this tool takes as much time and resources as compiling the compiler does. Also libraries as Gtk are huge! Generating for Gtk and its dependencies will take a long time and generate about a gigabyte of documentation.

1 Like

$crystal run samples/gtk_hello_world.cr
Runs fine

$crystal ./src/generator/build_namespace.cr
Produces :
Unhandled exception: Index out of bounds (IndexError)
from /usr/local/lib/crystal/indexable.cr:614:8 in ‘[]’
from src/generator/build_namespace.cr:4:1 in ‘__crystal_main’
from /usr/local/lib/crystal/crystal/main.cr:97:5 in ‘main_user_code’
from /usr/local/lib/crystal/crystal/main.cr:86:7 in ‘main’
from /usr/local/lib/crystal/crystal/main.cr:106:3 in ‘main’
from /usr/src/lib/csu/amd64/crt1.c:76:2 in ‘_start’

$crystal ./src/generator/build_namespace.cr gi-doc
Unhandled exception: Typelib file for namespace ‘gi-doc’ (any version) not found (Exception)
from src/g_lib/error.cr:4:7 in ‘assert’
from src/generated/g_i_repository/repository.cr:134:7 in ‘require’
from src/g_i_repository/repository.cr:12:7 in ‘require’
from src/g_i_repository/repository.cr:11:5 in ‘require’
from src/generator/namespace.cr:9:5 in ‘require’
from src/generator/namespace.cr:3:5 in ‘initialize’
from src/generator/namespace.cr:2:3 in ‘new’
from src/generator/build_namespace.cr:5:1 in ‘__crystal_main’
from /usr/local/lib/crystal/crystal/main.cr:97:5 in ‘main_user_code’
from /usr/local/lib/crystal/crystal/main.cr:86:7 in ‘main’
from /usr/local/lib/crystal/crystal/main.cr:106:3 in ‘main’
from /usr/src/lib/csu/amd64/crt1.c:76:2 in ‘_start’

Note :
crystal -v
Crystal 0.32.1 (2020-02-23)
LLVM: 9.0.0
Default target: x86_64-portbld-freebsd12.1

gi-doc is not a GObject based library itself but a target defined in the shard.yml :) To build it run shards build gi-doc inside the repository, which will provide you a bin/gi-doc executable.