Note that there are some explanatory texts on larger screens.

plurals
  1. PO.dylib made with Delphi XE2 cannot be used by Xcode app
    primarykey
    data
    text
    <p>I've built a 32-bit dylib for OS X with Delphi XE2 Upd. 3. It's install-name uses @rpath. All exports start with an underscore, verified with otool. The exports use "cdecl" calling convention in Delphi.</p> <p>I cannot get this dylib to work with a 32bit host application in Xcode 4.3 running on OS X 10.7.3. When I run the test project from within Xcode, it stops with the call to the lib and dyld_start in the call stack. </p> <p><img src="https://i.stack.imgur.com/xJOOs.png" alt="enter image description here"></p> <p>When I run this app from Finder (from the Xcode folder within the user-library), I get the Image Not Found error from dyld.</p> <p>I've already added a copy build phase, which copies the dylib (and libcgunwind.1.0.dylib which it requires) into the Products directory. I've also set Runpath Search Paths to @executable_path or @loader_path, all to no avail.</p> <p>The method is imported via </p> <pre><code>extern int TestLib(int AInt); </code></pre> <p>The library is as minimal as it can get and just contains this unit:</p> <pre><code>unit LibTestExports; uses System.Classes, System.SysUtils; function _TestLib(AInt: Integer): Integer; export; cdecl; begin Result:= AInt + 2; end; exports _TestLib; end. </code></pre> <p>I'm out of ideas on what is causing this and how I can get this to work.</p> <p>The Xcode project and the libs can be found here: <a href="http://dl.dropbox.com/u/17403534/CAS4LibTest.zip" rel="nofollow noreferrer">http://dl.dropbox.com/u/17403534/CAS4LibTest.zip</a></p> <p><strong>UPDATE:</strong> This problem seems to be Lion-specific! It works fine in Snow Leopard 10.6.4 using Xcode 4.2. (Xcode 4.2 on Lion results in the same problem)</p> <p>The same dylib also works just fine under Lion when used by a FireMonkey application (the methods are statically imported using <code>external 'libName'</code>). </p> <p>Running the same app under Lion, that works fine under SnowLeopard, I get a crash report containing the following call stack:</p> <pre><code>0 ??? 0x0013317c 0 + 1257852 1 libCAS4.dylib 0x00010b5c @DbgEvalFrame + 1648 2 libCAS4.dylib 0x00010e1a @DbgEvalFrame + 2350 3 dyld 0x8fe55203 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&amp;) + 251 4 dyld 0x8fe54d68 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&amp;) + 64 5 dyld 0x8fe522c8 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&amp;, unsigned int, ImageLoader::InitializerTimingList&amp;) + 256 6 dyld 0x8fe5225e ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&amp;, unsigned int, ImageLoader::InitializerTimingList&amp;) + 150 7 dyld 0x8fe53268 ImageLoader::runInitializers(ImageLoader::LinkContext const&amp;, ImageLoader::InitializerTimingList&amp;) + 62 8 dyld 0x8fe47694 dyld::initializeMainExecutable() + 214 9 dyld 0x8fe4bf99 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**) + 2238 10 dyld 0x8fe452ef dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*) + 637 11 dyld 0x8fe45063 _dyld_start + 51 </code></pre> <p><strong>Workaround:</strong> Embarcadero support now came back with a workaround, which fixes the issue for me: in a local copy of System.Classes change the declaration of GlobalNameSpace: IReadWriteSync to the appropriate class as used in the initialization section.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload