crystal-lang / crystal_lib

Automatic binding generator for native libraries in Crystal
138 stars 30 forks source link

Fix failing error when encountering Complex number type #62

Closed zph closed 6 months ago

zph commented 5 years ago

I was experimenting with building a shared library from Golang and using crystal_lib to generate the bindings.

It failed on _Complex type from the Golang generated header file (https://gist.github.com/zph/002dddd6e639ed55583968ddfa306431#file-nautilus-h-L47).

After this patch to crystal_lib, it was able to generate the following successfully:

@[Link(ldflags: "./nautilus.o")]
lib LibNautilus
  fun hello = SayHello(p0 : GoString)
  struct X_GoString
    p : LibC::Char*
    n : PtrdiffT
  end
  alias GoString = X_GoString
  alias PtrdiffT = LibC::Long
  fun bye = SayBye
end

Thanks for this experimental library and the continued work 👍