X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; q=dns; s=default; b= RC5Uk7itTKOgsPckTeThLUaifCl+lojnp1JCVMV8kT0E2XgJkc0NTNHFyIl5n1oy SlyVXHNg9/VPrCGN52/Dm4ztAp/i4A1afi/+i7p/t0LttSHahFYWo1gb4TGOkqaI qb0vRIgkjFRMXFxPZmMW6txixYzd8j0h/QHOyMI80oY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; s=default; bh=F1D3x /pWVycfpCNUhSPO03MWFcU=; b=qLEiPQ8EncXChrcD+ehlneIjQ+aY4V4GVMZKC wKhjD1RKaWYMkGI9Idnfdu0q7ZG7S0rZZ9OOEUydRbiCIMxBkuHwrbMc8JBy+26p c/zczBJp0flDS8UhQfDqoSAbQcYKW+E/utQcIxMT30KU6zTFYh+A1wwQwX0wmgiV 6WeLcI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f169.google.com MIME-Version: 1.0 X-Received: by 10.194.240.4 with SMTP id vw4mr8431239wjc.89.1444316088449; Thu, 08 Oct 2015 07:54:48 -0700 (PDT) In-Reply-To: References: <22038 DOT 29093 DOT 221000 DOT 863384 AT woitok DOT gmail DOT com> Date: Thu, 8 Oct 2015 16:54:48 +0200 Message-ID: Subject: Re: Running a program using a DLL under Cygwin From: Csaba Raduly To: cygwin list Cc: Rainer DOT Woitok AT gmail DOT com Content-Type: text/plain; charset=UTF-8 Hi, On Thu, Oct 8, 2015 at 3:56 PM, Yucong Sun wrote: Please don't top-post (https://cygwin.com/acronyms/#TOFU) > I think symlink is a cygwin thing. Windows won't find that DLL (just > like you won't find it using windows explorer.) > > Windows only support loading DLL from project directory, or system32 > as far as I know. There are rather more possibilities, listed here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx 1. The directory from which the application loaded. 2. The current directory. 3. The system directory. Use the GetSystemDirectory function to get the path of this directory. 4. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. 5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. 6. The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path. If SafeDllSearchMode is enabled, the current directory is demoted from #2 to #5 (just before the PATH search). There's also SetDllDirectory ( https://msdn.microsoft.com/en-us/library/windows/desktop/ms686203%28v=vs.85%29.aspx ) > > On Thu, Oct 8, 2015 at 9:37 PM, Dr Rainer Woitok > wrote: >> Greetings, >> >> I'm running a program which requires a DLL sitting in my "~/bin/" dir- >> ectory. Since "~/bin/" is contained in my "PATH" environment variable, >> everything works as desired. Recently I moved the DLL elsewhere, re- >> placing it with a symbolic link in "~/bin/". This caused the program to >> fail to locate the DLL. Moving the DLL back in place caused the program >> to work again. >> >> Is this a Windows problem (since DLLs are Windows rather than Unix) or >> Cygwin's? The link was created with the normal "ln -s" command. And, >> if that matters, Cygwin is running on Vista here. If the CYGWIN environment contains winsymlinks:native (https://cygwin.com/cygwin-ug-net/using.html#pathnames-symlinks) , Cygwin creates symlinks that Windows can understand. I don't know whether Windows will load a DLL if a native symlink to the DLL is in the PATH (or any other directories in the search list). Csaba -- GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++ The Tao of math: The numbers you can count are not the real numbers. Life is complex, with real and imaginary parts. "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds "People disagree with me. I just ignore them." -- Linus Torvalds -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple