creating a .dll on a mac: .dylib or framework?

时光毁灭记忆、已成空白 提交于 2019-11-29 02:53:22

问题


I need to create a Mac version of our libraries for one of our customers. I am not so familiar with dynamic libraries on Mac, but from what I understand, I have 2 options: .dylib or frameworks. What would be the best option? Why?

Few related questions:

  • If I understand correctly, .dylib have to be installed in one of the stnadard UNIX directories such as /usr/lib, etc. Hence using a .dylib should make my customer's installer much more complex, since they'll probably need to request permission to write something in a system folder?
  • Can frameworks be private and embedded within my customer's bundle? So no one else can see/use them?

Any constructive criticisms/comments/ideas more than welcome. Thanks in advance.

Alex


回答1:


.dylib is similar to .so on Linux.

Frameworks are basically just the OSX way of distributing libraries and headers together. They are the Application Bundle equivalent for library distribution.

With either method if you want to ensure other people don't use them you should be using static libraries (.a files) and getting your customer to statically link them into their application.

Otherwise there isn't really much difference between Frameworks and .dylib except the prior is nicer for OSX developers.

Either can be embedded inside a customers Application bundle, otool/install_name_tool handle them both fine.



来源:https://stackoverflow.com/questions/1212477/creating-a-dll-on-a-mac-dylib-or-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!