tag:blogger.com,1999:blog-5246987755651065286.post1313415205155692735..comments2024-02-22T16:15:42.388-08:00Comments on cbloom rants: 03-07-09 - Malloccbloomhttp://www.blogger.com/profile/10714564834899413045noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5246987755651065286.post-56053115622170701542009-03-12T17:02:00.000-07:002009-03-12T17:02:00.000-07:00I'm sure I remember reading somewhere in the onlin...I'm sure I remember reading somewhere in the online help that there are some FP support routines that you don't get the code for -- they're top secret, or something like that.<BR/><BR/>When I looked again just now, I couldn't find anything about it though. Did find this page with some licence-related notes:<BR/><BR/><A HREF="http://benjamin.smedbergs.us/blog/2008-01-10/patching-the-windows-crt/" REL="nofollow">http://benjamin.smedbergs.us/blog/2008-01-10/patching-the-windows-crt/</A><BR/><BR/>Sounds like our PC version can ship as-is. (But we statically link with all the libraries anyway, so it's not like anybody would know :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-57255311962610881802009-03-10T22:50:00.000-07:002009-03-10T22:50:00.000-07:00"But this is all details; MS provide the runtime s..."But this is all details; MS provide the runtime source code, so it's easy enough to work out what each function needs to do."<BR/><BR/>I've always wondered if you could actually take the MS CRT source and just compile it and have your own CRT (and thus be able to change or remove things you don't like).<BR/><BR/>eg. is it complete or did they leave out huge pieces? Is there some evil license on it?cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-88235522667238030212009-03-10T22:00:00.000-07:002009-03-10T22:00:00.000-07:00We've gone with the Scott Bilas approach of taking...We've gone with the Scott Bilas approach of taking bits out of the runtime library, but I ended up managing to remove ALL the memory allocation functions from the library. Equivalents are then provided in the game.<BR/><BR/>I think I started out by looking through the C runtime source for all the functions that had the word "alloc" in their names, and created a new library with their objects removed. Then I compiled the game, linking it with my new libraries, and wrote equivalent functions in the game, following the linker errors.<BR/><BR/>There are some internal allocation routines that need implementing (Bilas mentions __recalloc_crt, but I think there were a couple more too...), if you're linking with the debug libraries then you'll need _malloc_dbg and the like, and I'm sure there were a couple more surprises along the way. But this is all details; MS provide the runtime source code, so it's easy enough to work out what each function needs to do.<BR/><BR/>"A million dependencies" is over-egging things, if you ask me, but that's not to say it's as easy as gcc -wrap. I think it took about 2-3 hours from first having the idea to getting it basically working, then another hour a couple of days later because I'd managed to miss something.<BR/><BR/>(The C++ side is easier. The C++ RTL has one .obj that contains new/new[]/delete/delete[], as I recall, and once you remove that you're golden.)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-52247922158241170932009-03-08T17:29:00.000-07:002009-03-08T17:29:00.000-07:00Hi charles,Thanks for linking back two of my artic...Hi charles,<BR/><BR/>Thanks for linking back two of my articles.<BR/><BR/>The problem with only overloading the new operator is that you lose all the allocations happening in 3rdparties linked as dll.<BR/><BR/>It is a pity because if you want the full tracking memory scenario you need to resort to this hacks...enthttps://www.blogger.com/profile/09108774151576568024noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-4028995520578513322009-03-08T11:48:00.000-07:002009-03-08T11:48:00.000-07:00Another linky that belongs in your non-belonging l...Another linky that belongs in your non-belonging link bag:<BR/><BR/>http://graphics.stanford.edu/~seander/bithacks.htmlwon3dhttps://www.blogger.com/profile/09787472194187459747noreply@blogger.com