let cast_to_c_proto cfunc =
    let ret_type = match cfunc.returns with
        | None -> "void "
        | Some(atype) -> Format.sprintf "struct %s*" atype in
    let first = if cfunc.static then [] else [(GenCast.get_tname cfunc.inklass, "this")] in
    let params = first@cfunc.formals in
    let types = String.concat ", " (List.map (fun (t,v) -> "struct " ^ t ^ "*") params) in
    let signature = Format.sprintf "%s%s(%s);" ret_type cfunc.name types in
    if cfunc.builtin then Format.sprintf "" else signature