Dynamic library (dylib) for external object.

romaindumaine's icon

Hello,

I'm kind of new in developing external objects in C. So far I managed to compile my object, but when I shared it to friends to test it.
It did not work because the library wasn't install on their computer.

So I'm wondering if there is a way to include it in my object ??

To enter in details, I'm using liblo library to use OSC message (to send and receive). So when the object is loaded on a different computer, max can't find the dylib (liblo.7.dylib) on their computers.

Maybe I should not use a library and code in C myself. I went to http://archive.cnmat.berkeley.edu/OpenSoundControl/, but it wasn't a good help for me.

Anyone would have an hint for ?

Thanks a lot.

Rom

$Adam's icon

Hi,

this problem has been discussed more generally on the Forum before, basically with the 'usual' MS Visual Studio-related missing DLL hell (see https://cycling74.com/forums/vs-version-problems-when-releasing-objects-for-windows-using-visual-studio or https://cycling74.com/forums/visual-studio-express-2010-error etc.). The most usual solution to the missing shared library trouble is: just compile your external with static libraries. It will increase the size of your external, obviously, but you won't have the portability trouble...

Hope that helps,
Ádám

romaindumaine's icon

HI Adam,

Thank you for your quick answer, I forgot to mention that I'm on mac. I'm using Xcode 3.2.6.

I try the solution of the static lib, liblo.a. But this time the object was even not loaded at all (Unknown external object type).

$Adam's icon

Hi Rom,

yep, this is always a pain, both on Win and Mac (although I'm basically on Mac, too, so for me it's double-pain when compiling on Win due to my lack of Win-skills). But with proper compiler configuration, you can do it (I just don't remember, how, but wanted to encourage you to find the right way). Probably you should google it up.

Another alternative (which is what I do in most cases) would be -- if you have the source code of the library -- to simply copy the original source code files into your project and compile your external that way. Of course, you'll need to make some additional config stuff in most cases, but still, for me this method proved easier than anything else.

HTH,
Ádám

romaindumaine's icon

Hi again Ádám,

I will try this way, if I understand well, I should include the headers and the rest within my Xcode project ?

$Adam's icon

Hi Ron,

exactly. To see a (hopefully still) working example, check out the source code of my object called [sadam.lzo] in The sadam Library (see https://cycling74.com/forums/announce-the-sadam-library-version-2012-10-08 ).

Hope that helps,
Ádám

romaindumaine's icon

Hey Adam,

So I tried this way, but it didn't work.

By chance I found on monome forum, that someone made a Framework of the Liblo library, and managed to have it worked following this thread (https://cycling74.com/forums/frameworks-in-external-vs-framework-loading-in-standalone-app). At the moment I have to place the Framework into Max app. But will see if I can put it directly into the Max external.

Thanks for your help :)