delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/19/14:15:37

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Getting dpmi free memory info
Date: Mon, 19 Jan 1998 12:44:26 -0600
Organization: Cornell University
Lines: 51
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <34C39F0A.327A@cornell.edu>
References: <01bd24fb$b71d8bc0$673a63c3 AT default>
Reply-To: sinan DOT unur AT cornell DOT edu
NNTP-Posting-Host: 128
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ross Boast wrote:
> 
> Indeed, not as simple as it first seemed, its got me stumped anyhow.
> 
> Here's the function:
>  __dpmi_get_free_ memory_information(__dpmi_free_mem_info *_info)
> 
> And here's the struct which it should fill :
> 
>      typedef struct {
>        unsigned long largest_available_free_block_in_bytes;
>        unsigned long maximum_unlocked_page_allocation_in_pages;
>        unsigned long maximum_locked_page_allocation_in_pages;
>        unsigned long linear_address_space_size_in_pages;
>        unsigned long total_number_of_unlocked_pages;
>        unsigned long total_number_of_free_pages;
>        unsigned long total_number_of_physical_pages;
>        unsigned long free_linear_address_space_in_pages;
>        unsigned long size_of_paging_file_partition_in_pages;
>        unsigned long reserved[3];
>      } __dpmi_free_mem_info;
> 
> Er help!, i can't use intialize this struct with another variable because
> it says unkown storage calss which is understandable. I can't make a direct
> access to any of the variables in __dpmi_free_mem_info, so basically i'm
> stuck and i haven't got a clue, also let me know if i have to do something
> else due to the fact that its dpmi :). If someone could show me how to use
> 
> __dpmi_get_free_ memory_information(__dpmi_free_mem_info *_info)
> 
> and printf it i would be grateful!
> 

#include <dpmi.h>
#include <stdio.h>
void show_free_mem_info(void)
{
 __dpmi_free_mem_info i;
 __dpmi_get_free_memory_information(&i);

 printf("Largest available free block: %8.8x\n",
i.largest_available_free_block_in_bytes);

...etc ..etc}
 return;
}

i would recommend (re-)acquainting yourself with the basics of accessing
structure members in C. or maybe change "Boast" to something else...

  -- Sinan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019