1

I have a static library (.a) generated by the GNU tools for ARM on Linux enviromnent and want to use this library in Windows environment (Visual Studio 2008) using the Microsoft tools for ARM architecture. Is there any way to use .a static library with Microsoft tools?

I don't have the source code that's why I cannot cross compile the source code for MS compiler.

Thanks!

user2463118
  • 51
  • 1
  • 4
  • 2
    If the library is ELF, you have no chance, if it is COFF you may try to link and see what is happening, maybe you're lucky and the calling conventions are the same, etc. – joy Jun 07 '13 at 10:54
  • I have renamed it from .a to .lib, linked with Microsoft tools and invoked one of the function in that library. It give me the following error: fatal error LNK1107: invalid or corrupt file: cannot read at 0x1B9E20 – user2463118 Jun 07 '13 at 11:09
  • Changing the file extension does not convert the file content magically. Take a look at `objcopy` instead, which can convert between different objectfile formats. Note that the `*.a` files are "ar" archives, so you might have to unpack them first to process the contents. In any case, you need luck in order to get this to work, as Devolous explained below. – Ulrich Eckhardt Jun 09 '13 at 17:59

1 Answers1

2

Even if you could link it, that wouldn't help you. If it is compiled for a Linux environment, it means that system calls, etc. are for the linux operating system, which are not compatible with Windows. If you use cygwin, you might have a chance. If the library contains only supporting functions which don't require interaction with the OS, then you might give it a try, but I doubt that this works unless, as mentioned above, the library is compiled in COFF format.

Devolus
  • 21,661
  • 13
  • 66
  • 113