   SDL on Visual Studio 2005
  Helo everyone, I'm sorry if that was already answered, but I couldn't find anywhere the answer to this problem.I managed to make SDL work on Visual Studio 2003, but I cannot do it on 2005.The project is CLR/Windows Forms Application.I added nclude and kib directories to Visual Studio global directory list (as mentioned in the guide). I added "SDL.lib SDLmain.lib" to the command line in linker, and made sure "Multi-threaded Debug DLL (/MDd)" is selected (unlike VS 2003, it was already selected).While compiling I got this:LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:librarySDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _mainE:\Documents and Settings\takeda\My Documents\Visual Studio 2005\Projects\tkdNES\Debug\tkdNES.exe : fatal error LNK1120: 1 unresolved externalsFrom the past exerience with VS 2003, I modified main to "int main(int argc, char* argv[])".That is, I changed:[STAThreadAttribute]int main(array<System::String ^> ^args)to:[STAThreadAttribute]int main(int argc, char* argv[])(I just want to add, that my knowledge about .NET is pretty weak, I use CLR only for GUI, and the whole code is unmanaged).After that change, the program compiled fine, (only that one warning from above stayed, but I think it is unrelated), but program crashes:Unhandled exception at 0x00407869 in tkdNES.exe: 0xC0000005: Access violation reading location 0x00000000.Here's the assembly code:   _main:   00407860  push   ebp00407861  mov    ebp,esp    00407863  push   ebx00407864  mov    ebx,dword ptr [ebp+0Ch] 00407867  push   esi00407868  push   edi  00407869  mov    esi,dword ptr [ebx]    0040786B  mov    edi,dword ptr [__imp__strrchr (40A104h)]    00407871  push   5Ch  I marked the point with a , ebx is zero, so the problem is with accessing a NULL pointer.I guess my question is, how to make CLR/Windows Forms Application work from standard main() (so SDL will work right), or any other solution that will make the program run and work as it should.Please help.
Quote:(I just want to add, that my knowledge about .NET is pretty weak, I use CLR only for GUI, and the whole code is unmanaged).Large portions of your code are, in fact, managed. That's what code that runs on the CLR is, after all. Honestly, why don't you use C# and one of the SDL .NET wrappers if you're only using C++/CLI for the GUI?Quote:Unhandled exception at 0x00407869 in tkdNES.exe: 0xC0000005: Access violation reading location 0x00000000.You're dereferencing null. What's the code related to this (the assembly isn't that useful)? If it was before main, you probably shouldn't have changed the entry point and/or you probably didn't change it correctly.More information is required.   ;Quote:Large portions of your code are, in fact, managed. That's what code that runs on the CLR is, after all. Honestly, why don't you use C# and one of the SDL .NET wrappers if you're only using C++/CLI for the GUI?I never learned C#, also this is the first time I hear about .NET wrappers...Basicaly I started the program in command line, but because I needed to display more information about it status while running, I added GUI.I don't understand what you mean, that the majority of code is managed. My whole program is contained in several classes, one of them is initialized in the CLR code, and all control is done through it. SDL is used internally by those classes, I don't have any reference to SDL from the Form code.Quote:Quote:Unhandled exception at 0x00407869 in tkdNES.exe: 0xC0000005: Access violation reading location 0x00000000.You're dereferencing null. What's the code related to this (the assembly isn't that useful)? If it was before main, you probably shouldn't have changed the entry point and/or you probably didn't change it correctly.More information is required.It is in an assembly, because the crash happens even before the program starts to run. VC++ tells me that there is no source code available for that part.Here's stack trace:>tkdNES.exe!_main()  + 0x9 bytesC 00a5a167() mscorwks.dll!79e88f63()  [Frames below may be incorrect and/or missing, no symbols loaded for mscorwks.dll] mscorwks.dll!79e88f63()  mscorwks.dll!79e88ee4()  mscorwks.dll!79e88e31()  mscorwks.dll!79e88fe3()  mscorwks.dll!79e88db3()  mscorwks.dll!79e88dc3()  mscorwks.dll!79e7c34e()  mscorwks.dll!79e7c301()  mscorwks.dll!79f076f4()  mscorwks.dll!79e88d3b()  mscorwks.dll!79e7c301()  mscorwks.dll!79e88d19()  mscorwks.dll!79e88cf6()  mscorwks.dll!79ff9ea9()  mscorwks.dll!79e7c34e()  mscorwks.dll!79e7c301()  mscorwks.dll!79f076f4()  mscorwks.dll!79f082a9()  mscorwks.dll!79e7473a()  mscorwks.dll!79e74753()  mscorwks.dll!79e74811()  mscorwks.dll!79e74753()  ntdll.dll!7c9105c8()  ntdll.dll!7c910551()  ntdll.dll!7c91056d()  mscorwks.dll!79e783e6()  mscorwks.dll!79e7839d()  mscorwks.dll!79e782dc()  mscorwks.dll!79e782ed()  mscorwks.dll!79e9fc8d()  mscorwks.dll!79e9fb96()  ntdll.dll!7c91056d()  mscorwks.dll!79e783ca()  mscorwks.dll!79e783e6()  mscorwks.dll!79e7a39e()  mscorwks.dll!79ec44d2()  mscorwks.dll!79e783e6()  mscorwks.dll!79e7839d()  mscorwks.dll!79e782dc()  mscorwks.dll!79e782ed()  mscorwks.dll!79e782ed()  mscorwks.dll!79e7a9ff()  mscorwks.dll!79e7a9f6()  mscorwks.dll!79e7a9f6()  mscorwks.dll!79e7a9f6()  mscorwks.dll!79e7ee67()  mscorwks.dll!79e7a773()  mscorwks.dll!79f0817e()  mscorwks.dll!79e71862()  mscorwks.dll!79e8757b()  mscorwks.dll!79e782ed()  mscorwks.dll!79e8dd55()  mscorwks.dll!79e87adf()  mscorwks.dll!79e87b53()  mscorwks.dll!79e8837c()  ntdll.dll!7c9105c8()  ntdll.dll!7c910551()  ntdll.dll!7c91056d()  ntdll.dll!7c91056d()  ntdll.dll!7c911962()  ntdll.dll!7c911993()  mscorwks.dll!79e744b5()  mscorwks.dll!79e7473a()  mscorwks.dll!79e74753()  mscorwks.dll!79e78360()  ntdll.dll!7c91056d()  mscorwks.dll!79e783ca()  mscorwks.dll!79e783e6()  mscorwks.dll!79e7837f()  mscorwks.dll!79e78331()  mscorwks.dll!79e783e6()  mscorwks.dll!79e7839d()  mscorwks.dll!79e71862()  mscorwks.dll!79e782ed()  mscorwks.dll!79e782ed()  mscorwks.dll!79e7a9ff()  mscorwks.dll!79e7a9f6()  mscorwks.dll!79e8a797()  mscorwks.dll!79e8a7ab()  mscorwks.dll!79ebfe27()  mscorwks.dll!79e786aa()  mscorwks.dll!79eb80fa()  mscorwks.dll!79eb8141()  mscorwks.dll!79ed91f3()  ntdll.dll!7c9106eb()  mscorwks.dll!79e78360()  mscorwks.dll!79ebc7d8()  mscorwks.dll!79ebc7f7()  mscorwks.dll!79f07dc7()  mscorwks.dll!79f05f61()  mscoree.dll!79011b5f()  kernel32.dll!7c816ff7() You can see that main() didn't even started yet.BTW: thanks for blazing fast response. I never suspected that someone will reply so fast.   ;  After few hours I found a solution to this problem.I changed in Linker/Advanced/Entry point from "main" to "WinMainCRTStartup", and the program started working like it was in VS 2003.I still have one warning though:MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:libraryIs there more elegant solution than /NODEFAULTLIB? I feel that /NODEFAULTLIB just covers a potential problem...   