int test() { printf("Hello,C\n"); return 1; } int testSum(int a,int b) { return a + b; } void testPrintString(const char* str) { printf("%s",str); }
@asmname("test") func c_test() -> CInt // 声明,不需要 {} 函数体 @asmname("testSum") func c_testSum(a:CInt,b:CInt) -> CInt @asmname("testPrintString") func c_testPrintString(string:UnsafePointer) c_test() var sum = c_testSum(10, b: 20) print(sum) print("Hello, World!") c_testPrintString("Swift\n")
本文链接:https://it72.com/7839.htm