# Segmentation fault in linked files???



## micro01 (Aug 2, 2009)

Hello, all!

I'm using C::B.
My program builds correctly. However, on running the program (Play or Debug), the program crashes before the window is even painted (Win32 btw).

The call stack at the crash is something like: 

0 0004E458 ??()
1 0040FE25 __w32_sharedptr_initialize()
2 0040FB2F __do_global_ctors()
3 0040122A __mingw_CRTStartup()
4 00401298 mainCRTStartup()

Going to the next instruction enters ntdll!LdrDisableThreadCalloutsForDll()

7C90E47C	mov 0x4(%esp),%ecx
7C90E480	mov (%esp),%ebx
7C90E483	push %ecx
7C90E484	push %ebx
7C90E485	call 0x7c92a970 <towlower+298>
7C90E48A	or %al,%al
7C90E48C	je 0x7c90e49a <ntdll!LdrDisableThreadCalloutsForDll+30>
7C90E48E	pop %ebx
7C90E48F	pop %ecx
7C90E490	push $0x0
7C90E492	push %ecx
7C90E493	call 0x7c90d05e <ntdll!ZwContinue>
7C90E498	jmp 0x7c90e4a5 <ntdll!LdrDisableThreadCalloutsForDll+41>
7C90E49A	pop %ebx
7C90E49B	pop %ecx
7C90E49C	push $0x0
7C90E49E	push %ecx
7C90E49F	push %ebx
7C90E4A0	call 0x7c90d9ae <ntdll!ZwRaiseException>
7C90E4A5	add $0xffffffec,%esp
7C90E4A8	mov %eax,(%esp)
7C90E4AB	movl $0x1,0x4(%esp)
7C90E4B3	mov %ebx,0x8(%esp)
7C90E4B7	movl $0x0,0x10(%esp)
7C90E4BF	push %esp
7C90E4C0	call 0x7c90e528 <ntdll!RtlRandomEx>
7C90E4C5	ret $0x8

At which it sigsegv's at 7C90E48A.

I didn't post any of my code because it doesn't seem relevant (I think), what do y'all think caused the sigsegv?? :4-dontkno

Thanks!!


----------



## micro01 (Aug 2, 2009)

Ummm... 3 days+... anyone??


----------



## micro01 (Aug 2, 2009)

11 days... these aren't illegal, are they?


----------



## shuuhen (Sep 4, 2004)

The code is probably relevant. Also, which compiler, assembler, etc. could be relevant too. What exactly is C::B?


----------



## micro01 (Aug 2, 2009)

Horray thanks a reply!:smile:

Right, C::B... that's Code::Blocks.

Compiler is GCC... linking msimg32.dll, kernel32.dll, winmm.lib, and gdi32.lib.

Segmentation fault is accessing memory illegally... but this is [apparently] in a DLL...

I've attached my code ZIPped. (6 sources, 6 headers)

It's probably implied but this is C++ btw.

Thanks again! In the meantime I'll see what it does in another compiler. :normal:


----------



## micro01 (Aug 2, 2009)

Never mind, I think it had something related to corrupted project files, when I made a new project with the files in them everything went back to proper.

Though I do thank you for offering to look into it! 

BTW, when is one unable to edit a forum post anymore?? (I would've editted my previous one if I could!)


----------

