KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q65243: _memavl() Returns 0 If Not Bound with APILMR.OBJ

Article: Q65243
Product(s): See article
Version(s): 6.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 31-AUG-1990

When creating a large or compact model bound program that uses the
_memavl() function, APILMR.OBJ must be added to the BIND line or the
function will always return 0 (zero). The following code duplicates
the problem along with the solution:

Sample Code
-----------

#include <stdio.h>
#include <malloc.h>

int main(void)
{
   size_t bytes;

   bytes = _memavl();
   printf("_memavl returns: %x\n", bytes);
   return(0);
}

If the above code is compiled with /AL or /AC, and bound with BIND,
it will return the following message:

   _memavl returns: 0

However, when APILMR.OBJ is specified as follows, the program will
return a valid value:

   bind foo.exe apilmr.obj

For more information on the APILMR.OBJ file, query in QuickHelp on
BIND, then click the button for APILMR.OBJ.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.