How to use dylib for IOS Firemonkey

  

I’m using 3rd-party SDK, presented as libXXX.a, that needs

libstdc++.dylib
libz.dylib

If I would use this SDK in XCode, that would be no problem. But I’m using RAD Studio Firemonkey.

How to use dynamic libraries for IOS in RAD Studio Delphi
Firemonkey?
Are there any workarounds? XCode allows to link dylib while developing IOS app.

Thanks for directions to Hans. But…

I found needed libraries in C:\Users\Username\Documents\Embarcadero\Studio\SDKs\iPhoneOS9.0.sdk\usr\lib.

Following Embarcadero’s “brilliant” way of using static libraries I need create FakeLoader function under implementation section for being visible by my app like this:

implementation
procedure FakeLoader; cdecl; external ‘libXXX.a’ name ‘OBJC_CLASS_$_XXX’;

I copied founded libraries to project directory. Than I changed record:

procedure FakeLoader; cdecl; external ‘libXXX.a’ name ‘OBJC_CLASS_$_XXX’
dependency ‘libstdc++.dylib’, ‘libz.dylib’;

IDE said:

[DCC Error] E2597 ld: library not found for -llibstdc++.dylib

[DCC Error] E2597 ld: library not found for -llibz.dylib

Then I tried full path:

procedure MyFunction; cdecl; external ‘libXXX.a’ name ‘OBJC_CLASS_$_XXX’
dependency ‘C:\Users\Username\Documents\Embarcadero\Studio\SDKs\iPhoneOS9.0.sdk\usr\lib\libz.dylib’;

And IDE said again:

[DCC Error] E2597 ld: library not found for -lC:\Users\Nik\Documents\Embarcadero\Studio\SDKs\iPhoneOS9.0.sdk\usr\lib\libz.dylib

After that my guessworks ended. What’s wrong? Explain, please.

Added 11/11/2015:

When I compile without dependencies or with “stdc++”, error are:

Error: “__ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE6sentryD1Ev”, referenced from: __ZNSt3__1lsIwNS_11char_traitsIwEEEERNS_13basic_ostreamIT_T0_EES7_c in libHelloWorld.a(UploadTask.o); __ZNSt3__124__put_character_sequenceIwNS_11char_traitsIwEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libHelloWorld.a(UploadTask.o);
Error: “__ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsgetnEPcl”, referenced from: __ZTVNSt3__113basic_filebufIcNS_11char_traitsIcEEEE in libHelloWorld.a(UploadTask.o); __ZTVN5boost2io18basic_altstringbufIcNSt3__111char_traitsIcEENS2_9allocatorIcEEEE in libHelloWorld.a(UploadResTask.o); __ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE in libHelloWorld.a(TransferTask.o); __ZTVN5boost9re_detail10parser_bufIcNSt3__111char_traitsIcEEEE in libHelloWorld.a(instances.o);
Error: “__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev”, referenced from: _paprika_auth_create_with_deviceid in libHelloWorld.a(paprika.o); _paprika_auth_close in libHelloWorld.a(paprika.o); __ZN7Paprika14AuthTokenValueC1Ev in libHelloWorld.a(paprika.o); __ZNSt3__114__split_bufferINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERNS4_IS6_EEED2Ev in libHelloWorld.a(paprika.o); __ZNSt3__113__vector_baseINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS4_IS6_EEED2Ev in libHelloWorld.a(paprika.o); __ZN11OptionValueD2Ev in libHelloWorld.a(paprika.o); __ZN7Paprika14AuthTokenValueC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_ in libHelloWorld.a(paprika.o); …
Error: “__ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwm”, referenced from: _paprika_create_upload_stream in libHelloWorld.a(paprika.o); _paprika_create_download in libHelloWorld.a(paprika.o); __ZN5boost12basic_formatIwNSt3__111char_traitsIwEENS1_9allocatorIwEEEC2EPKw in libHelloWorld.a(UploadTask.o); __ZN7Paprika12DownloadTaskC2ERKNSt3__112basic_stringIwNS1_11char_traitsIwEENS1_9allocatorIwEEEES9_ in libHelloWorld.a(DownloadTask.o); __ZN7Paprika12getJsonValueERKN4Json5ValueEPKcPKw in libHelloWorld.a(JsonUtil.o);
Error: “__ZNSt3__18ios_base5clearEj”, referenced from: __ZN7Paprika10UploadTask17setUploadFileListERKNSt3__16vectorINS1_12basic_stringIwNS1_11char_traitsIwEENS1_9allocatorIwEEEENS6_IS8_EEEE in libHelloWorld.a(UploadTask.o); __ZN5boost10filesystem14basic_ofstreamIcNSt3__111char_traitsIcEEEC1ERKNS0_4pathE in libHelloWorld.a(UploadTask.o); __ZNK5boost2io6detail19stream_format_stateIwNSt3__111char_traitsIwEEE8apply_onERNS3_9basic_iosIwS5_EEPNS3_6localeE in libHelloWorld.a(UploadTask.o); __ZNSt3__1lsIwNS_11char_traitsIwEEEERNS_13basic_ostreamIT_T0_EES7_c in libHelloWorld.a(UploadTask.o); __ZNSt3__124__put_character_sequenceIwNS_11char_traitsIwEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libHelloWorld.a(UploadTask.o); __ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in libHelloWorld.a(UploadTask.o); __ZNK5boost2io6detail19stream_format_stateIcNSt3__111char_traitsIcEEE8apply_onERNS3_9basic_iosIcS5_EEPNS3_6localeE in libHelloWorld.a(UploadResTask.o); …
Error: “_SSLGetBufferedReadSize”, referenced from: _Curl_darwinssl_data_pending in libHelloWorld.a(libcurl_la-curl_darwinssl.o);
Error: “__ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEED1Ev”, referenced from: _paprika_create_upload_stream in libHelloWorld.a(paprika.o); _paprika_create_download in libHelloWorld.a(paprika.o); __ZNSt3__16vectorIN7Paprika10UploadTask8FileInfoENS_9allocatorIS3_EEE21__push_back_slow_pathIRKS3_EEvOT_ in libHelloWorld.a(paprika.o); __ZNSt3__114__split_bufferIN7Paprika10UploadTask8FileInfoERNS_9allocatorIS3_EEED2Ev in libHelloWorld.a(paprika.o); __ZNSt3__114__split_bufferINS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEERNS4_IS6_EEED2Ev in libHelloWorld.a(paprika.o); __ZNSt3__113__vector_baseIN7Paprika10UploadTask8FileInfoENS_9allocatorIS3_EEED2Ev in libHelloWorld.a(paprika.o); __ZNSt3__113__vector_baseINS_12basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEEENS4_IS6_EEED2Ev in libHelloWorld.a(paprika.o); …
Error: “__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5eraseEmm”, referenced from: __ZN4Json6Reader9readValueEv in libHelloWorld.a(json_reader.o); __ZN5boost10filesystem4path15remove_filenameEv in libHelloWorld.a(path.o); __ZN5boost9algorithm6detail21find_format_all_impl2INSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS1_13first_finderFIPKcNS0_8is_equalEEENS1_13const_formatFINS_14iterator_rangeISC_EEEENSG_INS3_11__wrap_iterIPcEEEESH_EEvRT_T0_T1_T2_T3_ in libHelloWorld.a(URLEncodeUtil.o); __ZNK5boost9re_detail31cpp_regex_traits_implementationIcE17transform_primaryEPKcS4_ in libHelloWorld.a(instances.o); __ZNK5boost9re_detail31cpp_regex_traits_implementationIcE9transformEPKcS4_ in libHelloWorld.a(instances.o);
Error: “__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm”, referenced from: _paprika_auth_create_with_deviceid in libHelloWorld.a(paprika.o); __ZN7Paprika14AuthTokenValueC1Ev in libHelloWorld.a(paprika.o); __ZNK11OptionValue21getLauncherIdentifierEv in libHelloWorld.a(paprika.o); __ZNK11OptionValue18getLauncherLinkURLEv in libHelloWorld.a(paprika.o); __ZN5boost9gregorian4dateC2ENS0_9greg_yearENS0_10greg_monthENS0_8greg_dayE in libHelloWorld.a(PushKeyTask.o); __ZN5boost9gregorian16bad_day_of_monthC2Ev in libHelloWorld.a(PushKeyTask.o); __ZN5boost9gregorian9bad_monthC2Ev in libHelloWorld.a(PushKeyTask.o); …

Comments are closed.