1.加载static library *.a文件
{$O-}
function XE4_testframe: testframe; cdecl;
external ‘libtestframe.a‘ name ‘OBJC_CLASS_$_testframe‘;
2.加载动态库
procedure XE4_AVFoundation; cdecl;
external ‘/System/Library/Frameworks/AVFoundation.framework/AVFoundation‘;
procedure XE4_libz; cdecl; external ‘/usr/lib/libz.dylib‘;
{$O+}
3.需要在deployment中输出相应的.a文件
4.需要在tool-option 中引入需要的framework 并update
5.普通接口定义
testframe = interface(NSObject)
[‘{B02FE219-DEBD-4581-A33E-5F167552BF28}‘]
function testfuc(value: integer): integer; cdecl;
function uv_InitVoiceApp: integer; cdecl;
function uv_StartVoiceListen: boolean; cdecl;
function delegate: pointer; cdecl;
procedure setDelegate(delegate: pointer); cdecl;
function busy:boolean;cdecl;
procedure setBusy(v:boolean);cdecl;
function uv_Speak(text:NSString):boolean;cdecl;
function IsSpeaking:boolean;cdecl;
end;
testframeClass = interface(NSObjectClass)
[‘{1ADAFF51-4474-47A1-8D39-723AC6680D51}‘]
end;
TTestFrame = class( TOCGenericImport<testframeClass, testframe> )
end;
6.delegate定义
IOS_VoiceDelegate = interface(IObjectiveC)
[‘{3A72F24D-9B7B-4E9D-A572-F282147526D2}‘]
procedure IOS_OnResult(resulttext: NSString); cdecl;
procedure IOS_OnVolumnChanged(volumn: integer); cdecl;
end;
TIOS_VoiceDelegate = class(TOCLocal, IOS_VoiceDelegate)
private
ftestframe: Tdpftestframe;
public
constructor Create(frame: Tdpftestframe);
procedure IOS_OnResult(resulttext: NSString); cdecl;
procedure IOS_OnVolumnChanged(volumn: integer); cdecl;
end;