X-Spam-Check-By: sourceware.org Date: Thu, 20 Apr 2006 13:19:00 -0700 From: Thomas Preisler Subject: how to get my app to find a dynamic library To: cygwin AT cygwin DOT com Message-id: <4447ECB4.5050707@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5 (Windows/20051201) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com I'm using Cygwin on Windows XP. gcc version 3.4.4. My main app 'main.c' is in one directory and I have a dynamic library 'cygmylib.dll' in a subdiretory 'tmp'. I can compile and link my main app fine but having trouble running it. It complaints about not being able to find the dynamic library. I have tried just about everything from -L, -Wl,-rpath using relative or absolute paths on the compile line to setting LD_LIBRARY_PATH and LD_RUN_PATH at run time, but to no avail. Here is how I link: gcc -o app main.c -Wl,-rpath tmp/ -Ltmp/ -lmylib If I run from the same directory, it cannot find the dynamic library. If I cd to tmp and run it like ../app it does run fine and finds the dynamic library, but this is not how I want to use it. Is there a special link option I need to use? What is the magic? Thanks. --thomas -- 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/