Re: SysAllocString
"George" <George@discussions.microsoft.com> wrote in message
news:7435D709-D058-48F7-8A4C-5C379539D6FD@microsoft.com
For example, I do not quite understand why using Windows API will make
application less dependent on system compared with using CRT API as
you mentioned.
I don't see anybody in this thread saying that using Windows API makes
an application less dependent on "system", whatever that means. Frankly,
the statement doesn't make much sense to me. Can you cite a direct
quote?
Windows API is part of the OS. Every module in every application running
on the same machine is calling the same implementation, guaranteed. You
can safely allocate a resource in one module and deallocate it in
another with a pair of complementary API functions. Windows API
functions can be called from most programming languages.
CRT is something an application carries with it. A CRT is peculiar to a
particular compiler, often to a particular version of a particular
compiler. Multiple, possibly incompatible, CRT versions may coexist on
the same machine and even within the same process. A module generally
has little control over what CRT other modules in the application use,
if any (e.g. modules written in languages other than C or C++ have no
idea about CRT). Thus, care should be taken to avoid contracts where a
resource allocated by a CRT function in one module is expected to be
deallocated by a complementary CRT function in another module.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925