原地址:http://zhidao.baidu.com/link?url=fzqefMM44ljXA5BnAbkX44SapCUteyzlXFvGLKvukBivm9AB-w39P_h7eX1ty-GQX8j3A03AZBPat6yMqjeY4Sc5jlaayMRVOigzCElm_Ky
so本質就是個動態鏈接庫
用gcc編譯就能生成了
Delphi XE里
if not Tfile.Exists(TPath.GetDocumentsPath+'/libserial_port.so') then begin showmessage(TPath.GetDocumentsPath+'/libserial_port.so not found'); end; Handle1:=LoadLibrary(pchar(TPath.GetDocumentsPath+'/libserial_port.so'));//動態裝入庫 if Handle1<>0 then //找到庫 begin fun1:=GetProcAddress(Handle1,'openport'); //搜索庫函數Add,並返回函數指針 if Assigned(fun1) then begin ......
至於上面的GetDocumentsPath 或者別的目錄也可以 參看TPath的說明和so文件存放目錄有關系
另外值得注意的事傳遞的字符串 xe中是雙字節的。