DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: liangjiping168
今日帖子: 16
在线用户: 7
导航: 论坛 -> 移动应用开发 斑竹:flyers,iamdream  
作者:
男 sail2000 (小帆工作室) ★☆☆☆☆ -
盒子活跃会员
2022/4/16 12:47:29
标题:
delphi 建立 so ,并让 Android 调用 浏览:1170
加入我的收藏
楼主: 首先,不要!从 DLL 向导中建立 so 工程,你要从 service (local service) 建立一个服务工程。
其次,将服务工程默认生出来的单元干掉,工程中的带 Application.xxx 代码也干掉, uses 段也干掉。
再其次,新建一个单元 Unit 文件,来写你的 Dll(so) 函数。
最后,编译出 so 给主程序调用。
Android Apk主程序没什么区别,自己在代码中动态拉权限,再按照普通调用 so 一样就行.


==========
1, don't! To build the so project from the DLL wizard, you need to build a service project from service wizard (local service).
2, delete the units that are generated by default in the service project, and also kill the application.xxx code in the project.The "uses" section is also removed.
Next, create a new Unit file to write your Dll(so) functions.
Finally, compile out so.
There is no difference in the main program of Android Apk, you can dynamically pull the permissions in the code, and then call so in the same way.

==========
see my test project:(extension name ".zip" -> ".7z")
IDE = Delphi 11.1
此帖子包含附件:sail2000_202241612472.zip 大小:10.86M
----------------------------------------------
delphi 是兴趣,和工作无关,即使它倒闭。又不靠它 delphi 吃饭,怕甚?
作者:
男 ghs_79 (ghs) ★☆☆☆☆ -
盒子活跃会员
2022/4/16 14:28:29
1楼: 厉害了
----------------------------------------------
Delphi爱好者。
作者:
男 pcplayer (pcplayer) ★☆☆☆☆ -
普通会员
2022/4/16 14:41:11
2楼: 假设你开发 APP,自然是一套代码,同时编译为 Android 和 iOS;

而 iOS 不允许动态加载一个库(.so),只能静态编译一个库到你的程序里面。

那么,单独为 Android 搞一个 .so 的意义是什么?
----------------------------------------------
-
作者:
男 sail2000 (小帆工作室) ★☆☆☆☆ -
盒子活跃会员
2022/4/16 16:07:52
3楼: @pcplayer (pcplayer)
有时候只想发布一个 so 给别人使用,并不想自己写 app,
正如 win 上,很多人写 DLL 给别人用一样。

可以参看 BASS 音频库的支持平台,它只出 DLL/so/...但它不出 EXE/APP,至于 IOS 平台,我为什么一样要鸟它?
----------------------------------------------
delphi 是兴趣,和工作无关,即使它倒闭。又不靠它 delphi 吃饭,怕甚?
作者:
男 janker (janker) ★☆☆☆☆ -
盒子活跃会员
2022/4/16 19:17:09
4楼: 标记下,学到了..........
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/16 21:35:14
5楼: as said by @sail2000 all S.O. mature, always works with library-to-programmers or end-user.

before, it was so much common use DLL (or library as you want) in MSWindows and Shared Objects in another system, or OVERLAYs in old-school-time...

Today, the pratice is online-"APIs"... in sumary, our old "DLL" in modern-fashion. If was possible, it would be just "DLL/SO/OVerLays/OBJ" etc...

the real sense is: protect the code against bad-use!

at end, it is just "code"... and "code" can be broked by hackers.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/4/17 5:08:35
6楼: really IS NOT NECESSARY USE "ANDROID SERVICE WIZARD" to create your SO file in Posix system.

the point is:
- On DPR file:
--- MSWindows:  library myDll;
--- Posix:   program mySO;


look my sample:
http://bbs.2ccc.com/topic.asp?topicid=628267
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行867.1875毫秒 RSS