INF: _memavl Returns 0 If Not Bound with APILMR.OBJ

ID Number: Q65243

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

Summary:

In Microsoft C versions 6.0, 6.0a, and 6.0ax, when a large or compact

model bound program that uses the _memavl function is created,

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);

}

More Information:

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.

Additional reference words: 6.00 6.00a 6.00ax