Mail Archives: cygwin/2004/01/27/10:51:36
At 06:47 AM 1/27/2004, Dave Korn you wrote:
>
>
>> -----Original Message-----
>> From: cygwin-owner On Behalf Of Przemyslaw Sliwa
>
>> I have a question regarding the dynamically linked libraries
>> in Cygwin.
>> When I compile my program under cygwin it uses the dlls. And
>> then during the runtime it loads all the functions from the dll.
>> A similar story we have under Linux when one uses the .lo or
>> .so files. However I want to use the compiles program on
>> another machine which does not have the cygwin suite. Under
>> Linux I just specify the option -STATIC and then the program
>> contains all the data needed by the program. I can take it on
>> another machine, which does not have the library and run it.
>> I suppose under cygwin I can do the same, but nowhere in the
>> docs it is written how.
>>
>> Could someone tell me how to compile a program so that it
>> contains all the functions needed by it in the exe file???
>
> Ideally, you'd simply build the cygwin dll from source as a static link
>library and add it to your exe. Unfortunately that turns out not to be
>possible because of various internal design features of cygwin. There are
>also licensing implications:
>
>http://cygwin.com/faq/faq_4.html#SEC98
>
> I don't know if there's any way to statically link a .dll into a .exe in
>general. However, you can simply distribute a copy of cygwin1.dll with your
>exe.
Actually, the recommended approach is to distribute your program that
depends on Cygwin and then point to cygwin.com's setup to install the
Cygwin package (and anything else needed/wanted). Obviously, this could
be automated too.
> This has a slight danger, that the version with your exe might clash with
>an existing version of cygwin dll already on the computer. To avoid this,
>you can install your exe and the cygwin dll into a directory of their own.
>Then you create a file in that directory that has the exact same name as
>your exe with ".local" appended. This means that when your .exe runs, it
>will look in the same directory for its dlls before it looks in the windows
>system dir. That way, your exe gets the version of the dll it expects, but
>none of the existing software on the machine you install will interact with
>it. Google for "side-by-side DLLs" if you want to know more.
Actually, this will still cause a clash for the Cygwin. But since
Cygwin DLLs are backward compatible, the recommended approach, which I
mentioned above, of distributing the Cygwin DLL will avoid any type of
clash.
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
838 Washington Street (508) 893-9889 - FAX
Holliston, MA 01746
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -