0
最近開始編碼雨燕3.0的Xcode 8.0 面臨的問題迅速指派類函數地址無效,其結構定義指針列表將函數分配給SWIFT 3中的空指針列表時出錯?
file.h
typedef struct MYStruct
{
void ** funptr; //The list of function pointer addr
size_t funCount;
} MYStruct;
file1.swift
.....
func Dummy()
{
}
func utility()
{
var myStructObj = MYStruct()
myStructObj.funptr = &Dummy() //Error: Cannot assign value of type '() -> Int32' to type 'UnsafeMutablePointer<UnsafeMutableRawPointer?>!'
......
//需要將此結構傳遞給C函數,在C函數中它會調用推遲函數來執行
cfunc(&myStructObj);
......
}
請建議我解決,謝謝提前