473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Premature .dll loading caused by "Project Dependencies" options

I have a Visual Studio Solution .sln which contains multiple projects,
including an ODBC driver .dll and a client .exe.

The client .exe is a simple MFC query tool. Nothing I can find in the client
references the driver directly. It uses a connection string to access the
driver, and does not provide this string until the user has filled in a
login dialog.

But when I debug the .exe, I see that the ODBC driver .dll is being loaded
very early, well before InitInstance() is reached. In fact, it's just the
4th item in the load order shown below:

'MyClient.exe': Loaded
'C:\Dev\MyProject\Connector\ODBC\exe\debug\bin\iwi nnt\MyClient.exe', Symbols
loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'MyClient.exe': Loaded
'C:\Dev\Siebel\Connector\ODBC\exe\debug\bin\iwinnt \MyDriver.dll',
Symbolsloaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
[etc.]

I can make the behavior go away by either:
(1) Compiling the client in its own, seperate .sln
or:
(2) Going into the .sln's "Project dependencies" dialog and unchecking the
box which makes the .exe dependent on the .dll.

The difference in the compiled result becomes more apparent when I look at
the .map files. When I leave the box unchecked or compile in a separate
..sln, the .map looks like:

0002:00037262 _SQLGetData@24 00459262 f
odbc32:ODBC32.dll
0002:00037268 _SQLDriverConnectW@32 00459268 f
odbc32:ODBC32.dll
0002:0003726e _SQLColumnsW@36 0045926e f
odbc32:ODBC32.dll

and the .dll loads as expected. But when I check the dependency box, it
looks like:

0002:000338ec _SQLGetData@24 004558ec f
oaodbcl:MyDriver.dll
0002:000338f2 _SQLDriverConnectW@32 004558f2 f
oaodbcl:MyDriver.dll
0002:000338f8 _SQLColumnsW@36 004558f8 f
oaodbcl:MyDriver.dll

The upshot of this is that my app crashes when I check the dependency box.
(Why? Not quite sure, there's some 3rd-party code involved, but it looks
like it's because the .dll is allocating some different TLS memory when it's
loaded, memory that becomes bogus by the time MFC tries to log in. This is
independent of a new MFC7.1 bug in the way it calls SQLDriverConnect.)

Is this really by design? This seems like a Visual Studio nmake(?) bug to
me. I don't see anything in the documentation that would imply that a
generated .exe will actually change when you check a Visual Studio Project
dependencies box.

--
Eric Hirst, SSE

Sorry, I don't want to test my company's spam filters.
Please follow up to newsgroup, or send mail to the
following address, which I check occasionally:

s-p-a-r-k-y-d-o-o-d-l-e-d-o-o
y-a-h-o-o
c-o-m
Nov 17 '05 #1
1 2068
Hm, no response. But I suppose everyone who tried to read the first post
fell asleep long before the punch line, which was, essentially:

"Arranging multiple C++ projects (.vcproj) in a single solution (.sln), then
marking one .vcproj as dependent on another doesn't just affect the build
order. It actually can affect the binaries of the dependent projects,
sometimes causing them to behave in unexpected ways. This bothers me. Does
it bother you too?"

-Eric

"Eric Hirst" <sp**@spam.spam> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
I have a Visual Studio Solution .sln which contains multiple projects,
including an ODBC driver .dll and a client .exe.

The client .exe is a simple MFC query tool. Nothing I can find in the client references the driver directly. It uses a connection string to access the
driver, and does not provide this string until the user has filled in a
login dialog.

But when I debug the .exe, I see that the ODBC driver .dll is being loaded
very early, well before InitInstance() is reached. In fact, it's just the
4th item in the load order shown below:

'MyClient.exe': Loaded
'C:\Dev\MyProject\Connector\ODBC\exe\debug\bin\iwi nnt\MyClient.exe', Symbols loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols
loaded.
'MyClient.exe': Loaded
'C:\Dev\Siebel\Connector\ODBC\exe\debug\bin\iwinnt \MyDriver.dll',
Symbolsloaded.
'MyClient.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded. 'MyClient.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded. 'MyClient.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
[etc.]

I can make the behavior go away by either:
(1) Compiling the client in its own, seperate .sln
or:
(2) Going into the .sln's "Project dependencies" dialog and unchecking the
box which makes the .exe dependent on the .dll.

The difference in the compiled result becomes more apparent when I look at
the .map files. When I leave the box unchecked or compile in a separate
.sln, the .map looks like:

0002:00037262 _SQLGetData@24 00459262 f
odbc32:ODBC32.dll
0002:00037268 _SQLDriverConnectW@32 00459268 f
odbc32:ODBC32.dll
0002:0003726e _SQLColumnsW@36 0045926e f
odbc32:ODBC32.dll

and the .dll loads as expected. But when I check the dependency box, it
looks like:

0002:000338ec _SQLGetData@24 004558ec f
oaodbcl:MyDriver.dll
0002:000338f2 _SQLDriverConnectW@32 004558f2 f
oaodbcl:MyDriver.dll
0002:000338f8 _SQLColumnsW@36 004558f8 f
oaodbcl:MyDriver.dll

The upshot of this is that my app crashes when I check the dependency box.
(Why? Not quite sure, there's some 3rd-party code involved, but it looks
like it's because the .dll is allocating some different TLS memory when it's loaded, memory that becomes bogus by the time MFC tries to log in. This is
independent of a new MFC7.1 bug in the way it calls SQLDriverConnect.)

Is this really by design? This seems like a Visual Studio nmake(?) bug to
me. I don't see anything in the documentation that would imply that a
generated .exe will actually change when you check a Visual Studio Project
dependencies box.

--
Eric Hirst, SSE

Sorry, I don't want to test my company's spam filters.
Please follow up to newsgroup, or send mail to the
following address, which I check occasionally:

s-p-a-r-k-y-d-o-o-d-l-e-d-o-o
y-a-h-o-o
c-o-m

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Schneider | last post by:
Please forgive me if this is a bit off topic, but I haven't had any takers in other forums. With ASP.NET projects, is it possible to have VS.NET automatically change the configuration options of...
1
by: Daniel | last post by:
loading web application project suddonly takes 5 mintues and says "Contacting server to open Web project.." wile it takes 5 minutes to load. how to fix? i tried reregistering asp.net and iisreset....
2
by: Axel Dahmen | last post by:
Hi, I'd like to write a simple COM Automation Server in C# but couldn't find a matching project. I want to have the IDE maintain the IDL and the REG file automatically. Which project should I...
5
by: Marco Zapletal | last post by:
hi group, i am facing the following problem: i have a vs.net (c#) project, which compiles into a class library. now i wrote a kind of testcase (with a main method()) which i want to execute...
4
by: Don Wash | last post by:
Hi There! I'm using "Copy Project" function of VS.NET to upload my ASP.NET application to my web server (not my own web server) and they have Front Page Server Extensions installed as well....
3
by: Mark.V.Sullivan | last post by:
I have encountered the same problem another posted about several months ago. Unfortunately, there was no result posted on the old thread. I will let the original message text stand and ask if...
3
by: GB | last post by:
Hi, I used VB2005 (VB.Net Apps) for about a year without problem. And all at a sydden, nothing works now : When starting a project in VB.net (debug mode), I get a strange message : "Error while...
1
by: Tina | last post by:
I have a project that I designed to be a "template" for other projects. It has all of the authentication and security functionality but is otherwise an empty project. How can I create a new...
0
by: howkoss | last post by:
Hi, I've been very frustrated for 2 days trying to make this work. I started with a built-in template "Projects" that came with Access 2007. On the "Employee List" I can click on any cell and bring...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.