Recent

Author Topic: how can I pack Library (*.dylib) files into the App container?  (Read 7953 times)

mapolat

  • New Member
  • *
  • Posts: 18
I would like to pack the library files (*.dylib) into the application containers (*.app). So I would like to pass libraries, which developed from me,  compactly with my application. How can I do it in Lazarus?

sorry for my bad english. :-[

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #1 on: August 19, 2011, 05:15:51 pm »
PackageMaker tool can be the solution for this. If you are using >10.6 it is in the /Development/Applications/Utilities directory.

« Last Edit: August 19, 2011, 05:19:25 pm by IndianaJones »

mapolat

  • New Member
  • *
  • Posts: 18
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #2 on: August 19, 2011, 11:03:06 pm »
Hi IndianaJones,

many thanks for quickly answer. But, PackageMaker is an installation routine. It copies the components in specified directories. And in addition; I cannot select the "/usr/lib/" directory as the destination directory for *.dylib files, this is not visible in Open/ChoiceDirectoryDialog on PackageManager-Configurationsdialog.
 
I also meant completely what differently. The *.dylib file should be packed directly in *.app container, thus I have an portable *.app file and not an installation routine.

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #3 on: August 20, 2011, 12:50:00 am »

So the result is, you want to copy .dylib file in your application directory isnt it?

mapolat

  • New Member
  • *
  • Posts: 18
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #4 on: August 20, 2011, 09:52:49 am »
I have tried it. It has not worked. The applikation does not start if mylib.dylib not in "/usr/lib/" is. How can I to reference on mylib.dylib in *.app container?

This tries were without success:
   DynLibs.LoadLibrary(mylib.dylib)
   DynLibs.LoadLibrary(./mylib.dylib)

I must say: I am a beginner in the MAC and Lazarus environments. I come from Win and Delphi world.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #5 on: August 20, 2011, 02:10:02 pm »
Which library exactly are you trying to load?

Are you importing its functions statically or dynamically?

The difference is explained here: http://wiki.lazarus.freepascal.org/Lazarus/FPC_Libraries#External_-_statically_loading_a_dynamic_library

If you dynamically loading the library, it should be easy, just obtain the path to the Bundle and then loaded from a path based on that:

http://wiki.lazarus.freepascal.org/OS_X_Programming_Tips#How_to_obtain_the_path_to_the_Bundle

If you are statically loading, then it is also possible, I already did this once, but I forgot completely how to do it =D

Search the Free Pascal mailling list or Mac-Pascal mailling list. I'm sure that somewhere there explains how to do it.

mapolat

  • New Member
  • *
  • Posts: 18
Re: how can I pack Library (*.dylib) files into the App container?
« Reply #6 on: August 20, 2011, 06:15:38 pm »
Hi felipemdc,

This was what I had searched. It works!

Thousand thanks.

 

TinyPortal © 2005-2018