delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/23/22:05:44

Date: Mon, 23 Feb 1998 19:04:53 -0800 (PST)
Message-Id: <199802240304.TAA28124@adit.ap.net>
Mime-Version: 1.0
To: "Pieter van Ginkel" <pginkel AT westbrabant DOT net>, <djgpp AT delorie DOT com>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: DPMI ???

At 05:56  2/23/1998 +0100, Pieter van Ginkel wrote:
>I'm deseret for using the dpmi functions in my new program, but I can't find
>a example of how to do it. I've tried it a little myself, but then I tried
>it, I got a SIGSEGV, so I've probably done something wrong. Could someone
>give me a simple (or more suphisticated) program that I can use to learn how
>to use dpmi. I was thinking of something like this:
>
>void main( void )
>{
>char * dummy = malloc( 81 );
>strcpy( dummy, "Hello world!" );
>cprintf( dummy );
>free( dummy );
>}
>
>But than with use of __dpmi_allocate_memory and other routines. If you have
>something that uses this way of allocating memory, but it's not at oll like
>this, also please send it to me.

First of all, I don't understand why you need or want to do this. `malloc'
should be perfectly adequate for almost any task.

Your problem is due to the fact that `__dpmi_allocate_memory' returns a
linear address. In order to use it, you have to go outside your normal data
segment. Your options then are to:
1. Create a segment for that area. FAQ section 18.7 talks about doing this,
although in relation to something else.
2. Use the easier but hazardous "nearptr" hack to access it. FAQ section
18.6 describes it.

Also, a couple of nettiquite issues.
1. Please try to stop your mailer from including an HTML copy of your
message. It's quite annoying.
2. It's redundant to send a message both to <djgpp AT delorie DOT com> and
<comp.os.msdos.djgpp>. All traffic from each one is reflected to the other,
so posting to both means it shows up twice.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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