Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access Violation in NTDLL.DLL

68 views
Skip to first unread message

tkin...@my-deja.com

unread,
Oct 1, 1999, 3:00:00 AM10/1/99
to
Does anyone know why this program, when linked with msvcrt.dll, and
"/nodefaultlib", crashes with...

First-chance exception in TestMe.exe (NTDLL.DLL): 0xC0000005: Access
Violation.

...

#include <stdio.h>

void main(void)
{
fprintf(stdout, "Hello there!!\n");
}

-Tom


Sent via Deja.com http://www.deja.com/
Before you buy.

Tim Ebben

unread,
Oct 1, 1999, 3:00:00 AM10/1/99
to
It works fine for me, using VC5 SP3. I added msvcrt.lib to the list of libraries to link with, checked "ignore all
default libraries," built, and ran with no problems.

--
Timothy J. Ebben
Levon's Wake, Inc.
Email: T...@LevonsWake.com
Web: www.LevonsWake.com

----- Paul Bunyan - Best damn logger there EVER was!

tkin...@my-deja.com wrote in message <7t12pi$48$1...@nnrp1.deja.com>...

tkin...@my-deja.com

unread,
Oct 9, 1999, 3:00:00 AM10/9/99
to
Thanks to Tim's expert assistance I now realize why my program was
crashing...

What I didn’t understand is that when I had previously built my program
without the “/nodefaultlib” linker switch I was implicitly linking with
“libc.lib” (the static, single threaded library). I also didn’t
understand that I must configure the compiler to generate code that is
appropriate for the library I am linking with. Thus, when I configured
the linker with the “/nodefaultlib” switch and then added msvcrt.lib (a
dynamic, multithreaded import library) to my list of libraries without
reconfiguring the compiler I created a conflict.

Resolution: I needed to change the compiler configuration to
generate object code for use with dynamic, multi-threaded libraries

How: Project Menu, Settings, C/C++ Tab, Category: Code Generation,
Use run-time library: Multithreaded DLL

IMHO: I was very disappointed that the linker did not warn me about
the potential problems I was creating when it encountered object code
which was not appropriate for the library it was being linked with!

Tom

In article <0%3J3.3042$L85.1...@ptah.visi.com>,


"Tim Ebben" <T...@LevonsWake.com> wrote:
> It works fine for me, using VC5 SP3. I added msvcrt.lib
> to the list of libraries to link with, checked "ignore all
> default libraries," built, and ran with no problems.
>
> --
> Timothy J. Ebben
> Levon's Wake, Inc.
> Email: T...@LevonsWake.com
> Web: www.LevonsWake.com

0 new messages