Re: using linux static library on windows

Discussion in 'C Programming' started by Nyven, Dec 24, 2004.

  1. Nyven

    Nyven Guest

    Okay, quick question... I need to write a wrapper dll, to access a *.a
    file under windows. Is it even possible?
     
    Nyven, Dec 24, 2004
    #1
    1. Advertising

  2. Nyven <> scribbled the following:
    > Okay, quick question... I need to write a wrapper dll, to access a *.a
    > file under windows. Is it even possible?


    Please ask in a Linux and/or Windows newsgroup.

    --
    /-- Joona Palaste () ------------- Finland --------\
    \-------------------------------------------------------- rules! --------/
    "Remember: There are only three kinds of people - those who can count and those
    who can't."
    - Vampyra
     
    Joona I Palaste, Dec 24, 2004
    #2
    1. Advertising

  3. Nyven

    jacob navia Guest

    Nyven wrote:
    > Okay, quick question... I need to write a wrapper dll, to access a *.a
    > file under windows. Is it even possible?
    >


    Everything is possible with SOFTware, you have just to
    bend it till it does what you want.

    1: Open the .a file.
    2: Extract each .o object file into a buffer.
    3: Translate the fixups and code/data
    sections into their windows equivalent, if any.
    If you ignore the C++ stuff and the non-existing
    translations, you obtain a COFF format object.
    4: Write the COFF format object into a windows library.

    Done.

    Of course this will crash at runtime (or will not link)
    if the code uses any external symbol (like fork()) that
    doesn't exist under windows.

    And even if it exists, the semantics can be slightly different.
    Malloc and other external functions from glibc are
    probably quite different from what the windows side is going
    to offer, but anyway, who cares?

    If the library is carefully written to run under windows
    it is possible that a hack like this would work but then,

    why not just recompiling under windows???

    jacob
     
    jacob navia, Dec 24, 2004
    #3
  4. Nyven

    Tim Prince Guest

    "Nyven" <> wrote in message
    news:...
    > Okay, quick question... I need to write a wrapper dll, to access a *.a
    > file under windows. Is it even possible?
    >

    No problem at all, if the .a file contains objects built to run on your OS.
    Maybe you're implying they were built for some other OS. Figure out what you
    want and which NG is appropriate.
     
    Tim Prince, Dec 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    840
    red floyd
    May 10, 2005
  2. Replies:
    2
    Views:
    6,513
    Maett
    May 16, 2005
  3. iceColdFire

    Static library Vs. Dynamic library

    iceColdFire, May 17, 2005, in forum: C++
    Replies:
    3
    Views:
    17,058
  4. Even

    static library and dynamic library

    Even, Oct 18, 2007, in forum: C Programming
    Replies:
    6
    Views:
    650
    Mark McIntyre
    Oct 20, 2007
  5. Krishna Chaitanya
    Replies:
    1
    Views:
    144
    Krishna Chaitanya
    Feb 27, 2009
Loading...

Share This Page