1

I have a static library, where one of the objects defines a symbol:

nm mylib.a
...
00007340 t _a_local_symbol
...

I need to access the function from my C code. Obviously, I don't have the source code for the library, so I can work only with the archive file that I have at hand.

This is further restricted by iOS linker.

A bit more context. The library is Objective-C++, the function in question is pure C. I don't have original headers, but I've got the function signature restored.

Farcaller
  • 3,070
  • 1
  • 27
  • 42
  • Can you give a bit more detail and context to the question please? Is the library pure C or objective-c? Are you wanting to call a function that isn't exposed in a header file, or something else? – Rick Aug 14 '12 at 21:41

1 Answers1

0

objcopy has a flag to do what you want:

--globalize-symbol <name> Force symbol <name> to be marked as a global

Not sure whether objcopy works on iOS object files though.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Objcopy is part of GNU binutils, and it seem to work with ELF only. Here's more on the subject: http://stackoverflow.com/questions/3475854/an-objcopy-equivalent-for-mac-iphone – Farcaller Aug 16 '12 at 08:57
  • Actually, at this point I've figured that I can possibly do it on the object file side, as there seem to be no direct solution for linker. – Farcaller Aug 16 '12 at 08:58