我找不到如何将此typedef struct TF_Status TF_Status;
视为抽象类型并绑定到该
c函数为TF_Status* TF_NewStatus();
data TF_Status
tfNewStatus : IO TF_Status
tfNewStatus = foreign FFI_C "TF_NewStatus" (IO TF_Status)
http://docs.idris-lang.org/en/latest/reference/ffi.html
它抱怨When checking argument fty to function foreign: Can't find a value of type FTy FFI_C [] (IO TF_Status)
答案 0 :(得分:1)
TF_Status* TF_NewStatus();
在被调用时返回指向TF_Status
的指针。所以你只需要
tfNewStatus : IO Ptr
tfNewStatus = foreign FFI_C "TF_NewStatus" (IO Ptr)