View Single Post
Old Mar 10th, 2008, 2:30 AM   #5
Irwin
Newbie
 
Join Date: Mar 2008
Posts: 9
Rep Power: 0 Irwin is on a distinguished road
Re: [MASM32] Working with arrays

Quote:
Originally Posted by Klarre View Post
Thanks for your input Irwin. I removed the msvcrt dependency from my project and changed the malloc function call to HeapAlloc since I read on MSDN that GlobalAlloc wasn't recommended.

Another question you may be able to answear on: Is it possible to link a program using the Visual Studio linker without linking with msvcrt.lib? I have set the entry point to main, but still got two linker errors I can't get rid of. So I guess it is impossible, right?
Error	1	error LNK2001: unresolved external symbol __RTC_Shutdown	main.obj
Error	2	error LNK2001: unresolved external symbol __RTC_InitBase	main.obj
HeapAlloc is only recommended for small buffers, so for anything from 64-1024 bytes I use GlobalAlloc (then use VirtualAlloc for anything larger). Anyway, for a function like GetKeyboardState (which I assume you're using), I would use GlobalAlloc.

Also, you can completely remove any CRT dependency from an application by adding the /NODEFAULTLIB linker flag, then coupling it with the /entry:main (or whatever your entry function is called).
Irwin is offline   Reply With Quote