博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Unity4.5版本DLL库名字问题
阅读量:7194 次
发布时间:2019-06-29

本文共 1131 字,大约阅读时间需要 3 分钟。

 

背景

在unity4.2版本中可以在Android中使用的so链接库,在Unity4.5中使不了~~

[DllImport("libclient.so", EntryPoint = "readFifo")]    private static extern int readFifo(int clientFd);

原因

最初一直以为是So的编译问题,结果测试几个之后还是一样,代码什么都不动,转换到4.5发布之后就不行。昨天发现这段话:

If you have control over the library name, keep the above naming conventions in mind and don’t use a platform-specific library name in the DllImport statement. Instead, just use the library name itself, without any prefixes or suffixes, and rely on the runtime to find the appropriate library at runtime. For example: [DllImport ("MyLibrary")] private static extern void Frobnicate ();Then, you just need to provide MyLibrary.dll for Windows platforms, libMyLibrary.so for Unix platforms, and libMyLibrary.dylib for Mac OS X platforms.

翻译过来就是不用对每个平台使用DLLIMPORT的时候使用不同的DLL名字,只需要使用DLL库本身的名字,不加任何的前缀或者后缀,系统会自动根据DLL名字和平台去搜索。比如:"MyLibrary" 在windows平台需要MyLibrary.dll , 在Android中需要libMyLibrary.so,在IOS中需要libMyLibrary.dylib . 

我的工程中实际名字是:libclient.so,所以可以这样写:

[DllImport("client", EntryPoint = "readFifo")]    private static extern int readFifo(int clientFd);
细雨标记:

 

参考地址:

转载于:https://www.cnblogs.com/zsb517/p/4096640.html

你可能感兴趣的文章
mysql-distinct去重、mysql-group …
查看>>
Vmworkstation启用错误
查看>>
mysql中函数DISTINCT,group by,CONCAT及GROUP_CONCAT的使用
查看>>
4月5日 编码问题
查看>>
消息反射
查看>>
DVWA之brute force
查看>>
HTML DOM 第一篇
查看>>
Java 枚举类型简介
查看>>
21. Merge Two Sorted Lists (Java 合并有序链表 空间复杂度O(1))
查看>>
Visual Studio 2010 Shortcut
查看>>
一些互联网术语
查看>>
ArrayList的底层实现
查看>>
基于Cyclone II Device Hankbook 的几种电压描述(转)
查看>>
springboot单元测试通过MockMvc类调用controller接口
查看>>
[NOI2013]快餐店
查看>>
Linux 文件操作总结
查看>>
Chrome下的语音控制框架MyVoix.js使用篇(三)
查看>>
【iOS】UIKit框架 学习笔记
查看>>
thinkphp5 自动注册Hook机制钩子扩展
查看>>
类的多态(虚函数)
查看>>