c++.windows.32-bits - Using new to allocate memory in Win32
- Dan Rushe (12/12) Aug 06 2001 Does DM implement the new operator when compiling Win32 apps? And
- Jan Knepper (8/13) Aug 06 2001 DMC++ has a very efficient memory management implementation which calls
- Walter (4/16) Aug 06 2001 The memory moving around was a problem in real mode windows, which was
- Dan Rushe (9/12) Aug 07 2001 So memory does not move around anymore? And if not, then the pointe...
- Jan Knepper (2/10) Aug 07 2001
- Walter (5/13) Aug 07 2001 They're just pointers now. A lot of documentation was written about real
- Jan Knepper (16/20) Aug 07 2001 Just to confuse things a little more M$ did the following in winnt.h (us...
- Walter (6/26) Aug 07 2001 reality,
- Jan Knepper (4/5) Aug 07 2001 Have you done anything on 'D' lately?
- Walter (2/7) Aug 08 2001
- jacob navia (1/1) Aug 17 2001 What is 'D' Walter?
- Jan Knepper (5/5) Aug 17 2001 Wow! You've missed some day yesterday!
- Rajiv Bhagwat (8/20) Aug 07 2001 All the technical discussion simply means:
- Jan Knepper (2/7) Aug 07 2001 AMEN!
- Dan Rushe (7/7) Aug 08 2001 Thanks to everybody who wrote back, I really appreciate it. I guess...
- Jan Knepper (2/5) Aug 08 2001 No Kidding!
- Dan Rushe (8/13) Aug 09 2001 Does anybody know of a good source of Win32 API information? As it ...
- Jan Knepper (2/13) Aug 09 2001
- Dan Rushe (6/7) Aug 09 2001 Damn, I was afraid you'd say that! Know of any good books?
- Jan Knepper (8/11) Aug 09 2001 Well, I didn't like saying it... But hey, for Win32 and all the
- Rajiv Bhagwat (6/17) Aug 11 2001 I hope you subscribe to DDJ, CUJ, MSDN (MSJ), Window Developer atleast?
Does DM implement the new operator when compiling Win32 apps? And if so, how does it work. Returning a pointer to an object is useless under Windows, especially when memory gets moved around. So, if new returns a pointer to the object, how could you possibly use it with Windows? I had Borland C++ 4.5, and the documentation said that it contained a heap manager, but it did not say how the pointers could be resolved. Any help would be appreciated. -- Dan Rushe thecourtjesture advnet.net
Aug 06 2001
Dan Rushe wrote:Does DM implement the new operator when compiling Win32 apps?Yes it does.And if so, how does it work. Returning a pointer to an object is useless under Windows, especially when memory gets moved around. So, if new returns a pointer to the object, how could you possibly use it with Windows?DMC++ has a very efficient memory management implementation which calls VirtualAlloc at the lowest level of the 'operator new' implementation as far as I know. VirtualAlloc is being called with MEM_COMMIT and PAGE_READWRITE if that is of any help. Jan
Aug 06 2001
The memory moving around was a problem in real mode windows, which was dumped by Microsoft by Windows version 3.1 (as I recall). This is not an issue in protected mode Windows, available from Windows 3.0 on. Dan Rushe wrote in message <3B6F1488.DF237A17 advnet.net>...Does DM implement the new operator when compiling Win32 apps? And if so, how does it work. Returning a pointer to an object is useless under Windows, especially when memory gets moved around. So, if new returns a pointer to the object, how could you possibly use it with Windows? I had Borland C++ 4.5, and the documentation said that it contained a heap manager, but it did not say how the pointers could be resolved. Any help would be appreciated. -- Dan Rushe thecourtjesture advnet.net
Aug 06 2001
Walter wrote:The memory moving around was a problem in real mode windows, which was dumped by Microsoft by Windows version 3.1 (as I recall). This is not an issue in protected mode Windows, available from Windows 3.0 on.So memory does not move around anymore? And if not, then the pointers should remain valid. The reason I need to know, is that I'm trying to implement a linked list in Windows, and I wasn't impressed with using handles to memory blocks for each item. -- Dan Rushe thecourtjesture advnet.net
Aug 07 2001
The handles in Win32 are actually pointers... Dan Rushe wrote:Walter wrote:The memory moving around was a problem in real mode windows, which was dumped by Microsoft by Windows version 3.1 (as I recall). This is not an issue in protected mode Windows, available from Windows 3.0 on.So memory does not move around anymore? And if not, then the pointers should remain valid. The reason I need to know, is that I'm trying to implement a linked list in Windows, and I wasn't impressed with using handles to memory blocks for each item.
Aug 07 2001
Dan Rushe wrote in message <3B70034E.15A4BD8E advnet.net>...Walter wrote:They're just pointers now. A lot of documentation was written about real mode windows programming that never got updated to protected mode reality, so it's easy to get the impression you still need to worry about real mode issues.The memory moving around was a problem in real mode windows, which was dumped by Microsoft by Windows version 3.1 (as I recall). This is not an issue in protected mode Windows, available from Windows 3.0 on.So memory does not move around anymore? And if not, then the pointers should remain valid. The reason I need to know, is that I'm trying to implement a linked list in Windows, and I wasn't impressed with using handles to memory blocks for each item.
Aug 07 2001
They're just pointers now. A lot of documentation was written about real mode windows programming that never got updated to protected mode reality, so it's easy to get the impression you still need to worry about real mode issues.Just to confuse things a little more M$ did the following in winnt.h (used for all Win32 platforms): typedef void *PVOID; [ ... snip ... ] #ifdef STRICT typedef void *HANDLE; #define #else typedef PVOID HANDLE; #define DECLARE_HANDLE(name) typedef HANDLE name #endif typedef HANDLE *PHANDLE; So basically a 'HANDLE' is 'void *' <g> Jan
Aug 07 2001
This kind of fiddling is why D has typechecking for typedef'd names. Jan Knepper wrote in message <3B700A93.F41EFC25 smartsoft.cc>...reality,They're just pointers now. A lot of documentation was written about real mode windows programming that never got updated to protected modemodeso it's easy to get the impression you still need to worry about realforissues.Just to confuse things a little more M$ did the following in winnt.h (usedall Win32 platforms): typedef void *PVOID; [ ... snip ... ] #ifdef STRICT typedef void *HANDLE; #definestruct#else typedef PVOID HANDLE; #define DECLARE_HANDLE(name) typedef HANDLE name #endif typedef HANDLE *PHANDLE; So basically a 'HANDLE' is 'void *' <g> Jan
Aug 07 2001
Have you done anything on 'D' lately? To prepare I could begin creating a newsgroup 'd' <g> Jan Walter wrote:This kind of fiddling is why D has typechecking for typedef'd names.
Aug 07 2001
I'm working on it again... Jan Knepper wrote in message <3B701B60.ACED67DE smartsoft.cc>...Have you done anything on 'D' lately? To prepare I could begin creating a newsgroup 'd' <g> Jan Walter wrote:This kind of fiddling is why D has typechecking for typedef'd names.
Aug 08 2001
Wow! You've missed some day yesterday! http://www.digitalmars.com/D/ news://news.digitalmars.com/D I guess we could say we were slashdotted yesterday... Jan
Aug 17 2001
All the technical discussion simply means: - go ahead with your linked list without any worries about memory moving. Your pointers will NOT change on you without you doing so!! As far as the programmers are concerned, the same linked list code should work for DOS, Unix or current versions of Windows. -- Rajiv Bhagwat Dan Rushe <thecourtjesture advnet.net> wrote in message news:3B70034E.15A4BD8E advnet.net...Walter wrote:The memory moving around was a problem in real mode windows, which was dumped by Microsoft by Windows version 3.1 (as I recall). This is not an issue in protected mode Windows, available from Windows 3.0 on.So memory does not move around anymore? And if not, then the pointers should remain valid. The reason I need to know, is that I'm trying to implement a linked list in Windows, and I wasn't impressed with using handles to memory blocks for each item. -- Dan Rushe thecourtjesture advnet.net
Aug 07 2001
Rajiv Bhagwat wrote:All the technical discussion simply means: - go ahead with your linked list without any worries about memory moving. Your pointers will NOT change on you without you doing so!! As far as the programmers are concerned, the same linked list code should work for DOS, Unix or current versions of Windows.AMEN!
Aug 07 2001
Thanks to everybody who wrote back, I really appreciate it. I guess it is now time to retire my Windows API Bible from 7 years back and get an updated version! -- Dan Rushe thecourtjesture advnet.net
Aug 08 2001
Dan Rushe wrote:Thanks to everybody who wrote back, I really appreciate it. I guess it is now time to retire my Windows API Bible from 7 years back and get an updated version!No Kidding!
Aug 08 2001
Jan Knepper wrote:Dan Rushe wrote:Does anybody know of a good source of Win32 API information? As it turns out, I was trying to reinvent the wheel. I was working on a tree list control, but then I realized that Windows 9x already has one. -- Dan Rushe thecourtjesture advnet.netThanks to everybody who wrote back, I really appreciate it. I guess it is now time to retire my Windows API Bible from 7 years back and get an updated version!No Kidding!
Aug 09 2001
Well, It's called MSDN I guess, you can buy it from M$... Dan Rushe wrote:Jan Knepper wrote:Dan Rushe wrote:Does anybody know of a good source of Win32 API information? As it turns out, I was trying to reinvent the wheel. I was working on a tree list control, but then I realized that Windows 9x already has one.Thanks to everybody who wrote back, I really appreciate it. I guess it is now time to retire my Windows API Bible from 7 years back and get an updated version!No Kidding!
Aug 09 2001
Jan Knepper wrote:Well, It's called MSDN I guess, you can buy it from M$...Damn, I was afraid you'd say that! Know of any good books? -- Dan Rushe thecourtjesture advnet.net
Aug 09 2001
Dan Rushe wrote:Jan Knepper wrote:Well, I didn't like saying it... But hey, for Win32 and all the other cr*p that makes part of the alternative (M$) operating systems it's probably the best resource... Good books... Depends on what you want to do... Check digitalmars.com, there might be a reference to a book. Otherwise... Search for them on Amazon.com... JanWell, It's called MSDN I guess, you can buy it from M$...Damn, I was afraid you'd say that! Know of any good books?
Aug 09 2001
I hope you subscribe to DDJ, CUJ, MSDN (MSJ), Window Developer atleast? These mags contain some good articals on the practical aspects and are my substitue to the MSDN subscription. -- Rajiv Bhagwat Jan Knepper <jan smartsoft.cc> wrote in message news:3B7329C4.A6496892 smartsoft.cc...Dan Rushe wrote:Jan Knepper wrote:Well, I didn't like saying it... But hey, for Win32 and all the other cr*p that makes part of the alternative (M$) operating systems it's probably the best resource... Good books... Depends on what you want to do... Check digitalmars.com, there might be a reference to a book. Otherwise... Search for them on Amazon.com... JanWell, It's called MSDN I guess, you can buy it from M$...Damn, I was afraid you'd say that! Know of any good books?
Aug 11 2001