Jump to content
Sign in to follow this  
LairdTurnerSpecial

Linking to a static ARM64 lib FMX iOS

Recommended Posts

Hi!

 

I have a static lib 'lib.a' with objective-c code in it. The exports can be seen via nm lib.a.
To make a wrapper for delphi I followed the common pattern with the trick to add loader func at the end of the unit.

 

unit iOSapi.libtest;

interface

uses
  Macapi.ObjectiveC,
  iOSapi.Foundation;

const
    libSD = 'lib.a';
    PREFIX = '_OBJC_CLASS_$_';

type
    ProductManager = interface;

    ProductManagerClass = interface(NSObjectClass)
    ['{893A533F-E103-4898-A5CC-73185803FFF0}']
    function GetInstance: ProductManager; cdecl;
    end;

    ProductManager = interface(NSObject)
    ['{FF519D81-5CF0-4ADF-B37B-2E965EB858A7}']
    end;
    TProductManager = class(TOCGenericImport<ProductManagerClass, ProductManager>)
    end;

implementation

procedure libSDLoader; cdecl; external libSD name PREFIX + 'ProductManager';

end.

For simplicity I've created a base app for iOS. Where I call

TProductManager.OCClass.GetInstance;

in the FormShow event.
When I start the app in debug mode I get an 'EObjectivceC' Exception with the message that
the Objecive-C-Class 'ProductManager' was not found.

 

image.thumb.png.307418b1e63d467741950f64eb7c414a.png

 

Any suggestions what I'm doing wrong?

 

regards

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×