No announcement yet.

GlobalMem Alloc = GlobalAlloc ?

  • Filter
  • Time
  • Show
Clear All
new posts

  • GlobalMem Alloc = GlobalAlloc ?

    In the likely event to make me look very silly without pulling a funny face

    Is GlobalMem Alloc (keyword in PB 9.0) the same as using the GlobalAlloc
    exported function in kernel32.dll ?

    I read somewhere long ago that GlobalAlloc should not be used since it was
    depreciated, is it ?


    So here we are, this is the end.
    But all that dies, is born again.
    - From The Ashes (In This Moment)

  • #2
    They are not deprecated. The heap functions are preferred because they are faster and have more features, but the global functions are still used with DDE, the clipboard functions, and OLE data objects.


    • #3
      As a rule you never want to make an assumption about "how" any particular intrinsic function is implemented - by any compiler publisher for any programming language product.

      You should use whatever capabilities and limitations are documented by the publisher as the basis for any programming decisions.

      Just looking at the summary descriptions, I would *GUESS* "GLobalAlloc" is the current underlying "method of choice" but you don't want to rely on that because it is proprietary - meaning that method of choice is subject to change without notice.

      It's kind of like the PB "OPEN" verb for disk files... CreateFile() is surely the 'method of choice' used to implement it, but you have no way to know what flags and attributes are used on the OPEN.

      Or SHELL... last time I tested it (7x?) CreateProcess() was used. But no reason PB could not change to ShellExecute, ShellExecuteEx or CreateProcessAsUser to implement the behavior guaranteed for SHELL.

      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]