R.W
R.W

Reputation: 560

Calling a function inside iOS static library from command line

We have some functions made available to us in iOS static library. There is a header (.h) and the compiled (.a) file. Is there any way that the functions in the static library can be called from a command line ( either OS X, Windows or Linux )? I have researched this for couple of days now and I am starting to doubt if this is even possible? We don't deal with Apple/iOS/xcode environment and the vendor only has this static library. Any hints? If it is possible in anyway I am open to reading any and very documentation but at this time I am in doubt if this is even possible? thanks

While checking out what is possible, I ran this

lipo -info libExaNumberCalc.a

I ran the above and it says

Architectures in the fat file: libExaNumberCalc.a are : i386 armv7 x86_64 arm64

Wonder if the above adds any hope?

Upvotes: 0

Views: 298

Answers (1)

Mindaugas
Mindaugas

Reputation: 1735

The first thing that springs to mind is that you could write thin wrapper around your library function and build/run it. Something like

// main.c
#include "your_library_header.h"

int main(int argc, char *argv[])
{
  // parse & pass parameters if necessary from command line

  your_lib_function();

  return 0;
}

Build with something like

clang main.c -o output.file -lyourlibrary

Upvotes: 1

Related Questions