Hi,
I'm using this library to build my toy language recently, the experience is awesome. However, things become wired when I try to play with function pointers.
Consider the example in #215 , the ir generated from C has the struct type { i32 (i32, i32)*, double (double)* } which is right and the go code following it shall generate exactly same structure. However, if you print structType.LLString(), the output is { i32 (i32, i32), double (double) }, which is a struct contains two value type rather than pointer.
In my opinion, there might be a mistake in ir.Func‘s type. It should be a pointer type rather than a plain function type. This issue may lead to wrong error message while storing function pointers into variables.
Oh, I'm really sorry. Seems the type in ir.Func is right. The example above is using function types return from NewFunc call. Thanks again for building this amazing library!
Hi,
I'm using this library to build my toy language recently, the experience is awesome. However, things become wired when I try to play with function pointers.
Consider the example in #215 , the ir generated from C has the struct type
{ i32 (i32, i32)*, double (double)* }
which is right and the go code following it shall generate exactly same structure. However, if you printstructType.LLString()
, the output is{ i32 (i32, i32), double (double) }
, which is a struct contains two value type rather than pointer.In my opinion, there might be a mistake in
ir.Func
‘s type. It should be a pointer type rather than a plain function type. This issue may lead to wrong error message while storing function pointers into variables.