delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/24/15:05:47

X-Spam-Check-By: sourceware.org
X-Mail-Handler: MailHop Outbound by DynDNS
X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information)
X-MHO-User: postmaster AT innobec DOT com
Message-ID: <44EDF86F.6030107@innobec.com>
Date: Thu, 24 Aug 2006 15:05:19 -0400
From: Pierre Baillargeon <pbaillargeon AT innobec DOT com>
User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: no message or dialog when a DLL is missing
References: <44ECC152 DOT 3020503 AT innobec DOT com> <Pine DOT GSO DOT 4 DOT 63 DOT 0608231740100 DOT 19954 AT access1 DOT cims DOT nyu DOT edu> <44EDA26C DOT 6000603 AT innobec DOT com> <Pine DOT GSO DOT 4 DOT 63 DOT 0608241225350 DOT 3875 AT access1 DOT cims DOT nyu DOT edu>
In-Reply-To: <Pine.GSO.4.63.0608241225350.3875@access1.cims.nyu.edu>
X-SA-Do-Not-Run: IfYouSaySo
X-SA-Exim-Connect-IP: 192.168.62.162
X-SA-Exim-Mail-From: pbaillargeon AT innobec DOT com
X-SA-Exim-Scanned: No (on rodriguez); SAEximRunCond expanded to false
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Ok, first I want to show you the minimal test-case I built. Using Visual 
Studio 8, I created a solution containing two projects: a Win32 console 
application and a Win32 DLL. I deleted all the generated stuff and 
replaced them with a single file per project.

The console application project is called NoDLL and its file is called 
NoDLL.c:

__declspec( dllimport ) void __stdcall cant_touch_this();

int main(int argc, char* argv[])
{
     cant_touch_this();
     printf("World!\n");
	return 0;
}

The DLL project is called Missing and its file is called Missing.c:

__declspec( dllexport ) void __stdcall cant_touch_this()
{
     printf("Hello\n");
}

The console project is set to depend on the DLL project: Project menu, 
Project Dependencies... menu item, select the console application in the 
drop down combo-box, check mark the DLL in the list box below it. Now 
the console depends on the DLL and will be linked with its .lib file.

Now, after building the project, I have NoDLL.exe and Missing.dll in the 
same directory.

In a bash shell started from a shortcut (i.e. bash inside cmd.exe), I 
start NoDLL.exe. I get Hello World! as expected. I move the DLL 
elsewhere, now the program does nothing and the exit code (echo $?) is 128.

If I start the program right then in another Windows cmd.exe, i get a 
nice error dialog saying "This application has failed to start because 
Missing.dll was not found. Re-installing the application may fix this 
problem." With the title "NoDLL.exe - Unable To Locate Component". Same 
thing if I double click NoDLL.exe from Windows Explorer.

This difference in behavior was my reason to write in.

Now, about cygcheck. Two cases.

1. If the current directory is where NoDLL.exe and Missing.dll are. In 
this case, I get:

.\NoDLL.exe
   .\Missing.dll
     C:\WINDOWS\system32\KERNEL32.dll
       C:\WINDOWS\system32\ntdll.dll

or

.\NoDLL.exe
Error: could not find Missing.dll
   C:\WINDOWS\system32\KERNEL32.dll
     C:\WINDOWS\system32\ntdll.dll

2. If the current directory is *not* where NoDLL.exe and Missing.DLL 
are. In the case, I always get:

/path/to/where/the/program/is/NoDLL.exe - Cannot open

*Even* if Missing.DLL is present next to NoDLL.exe and NoDLL.exe and can 
be launchedproperly in bash!

Sorry, I was not able to rapidly make the DLL and executable with gcc. 
trying only to build the program, with the DLL already built by MSVC, 
using "gcc -mno-cygwin -L./Debug -lMissing NoDLL.c", resulted in 
"/cygdrive/c/Temp/ccMLHNI5.o:NoDLL.c:(.text+0x2b): undefined reference 
to `__imp__cant_touch_this AT 0'".

-- 
Pierre Baillargeon
Innobec

--
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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019