comp.lang.ada
 help / color / mirror / Atom feed
* bug in DEC compiler??
@ 1989-01-26  0:51 gerhardt
  1989-01-27  3:48 ` Jeff Bartlett
  0 siblings, 1 reply; 2+ messages in thread
From: gerhardt @ 1989-01-26  0:51 UTC (permalink / raw)


We have tried to use the SAIC X window binding with the DEC ACS
compiler.

We are having problems with what looks like a bug in DEC ACS Ada.

The code fragment looks like :

	type FOO is record... end record;
	type CLIST is access FOO;
	procedure EXT ( A : in out SYSTEM.ADDRESS ) is ... end;
	pragma INTERFACE (EXT, SYSTEM.ADDRESS, VALUE);
	LOC : CLIST;
begin
	EXT(LOC.all.'ADDRESS);

...


This code compiles but when it runs it loses the address when it gets
to the externaL procedure (WRITTEN IN C).  

When an unchecked conversion to SYSTEM.ADDRESS is done on LOC and that
is used as the calling parameter, it works ok.  Am I missing
something, or is this
a plain old bug??  Thanks in advance


MArk Gerhardt
ESL, INC
reply : gerhardt@ajpo.sei.cmu.edu

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bug in DEC compiler??
  1989-01-26  0:51 bug in DEC compiler?? gerhardt
@ 1989-01-27  3:48 ` Jeff Bartlett
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Bartlett @ 1989-01-27  3:48 UTC (permalink / raw)


In article <8901260051.AA26048@ajpo.sei.cmu.edu>, gerhardt@AJPO.SEI.CMU.EDU writes:
> We have tried to use the SAIC X window binding with the DEC ACS
> compiler.
 
> We are having problems with what looks like a bug in DEC ACS Ada.
 
> The code fragment looks like :
 
> 	type FOO is record... end record;
> 	type CLIST is access FOO;
> 	procedure EXT ( A : in out SYSTEM.ADDRESS ) is ... end;
> 	pragma INTERFACE (EXT, SYSTEM.ADDRESS, VALUE);
> 	LOC : CLIST;
> begin
> 	EXT(LOC.all.'ADDRESS);
 
> This code compiles but when it runs it loses the address when it gets
> to the externaL procedure (WRITTEN IN C).  
 
> When an unchecked conversion to SYSTEM.ADDRESS is done on LOC and that
> is used as the calling parameter, it works ok.  Am I missing
> something, or is this
> a plain old bug??  Thanks in advance

This works:

-- zip.ada

with SYSTEM;
procedure ZIP is

   type FOO is
	record
	BAR : INTEGER;
	end record;

   type CLIST is access FOO;

   procedure EXT( A : SYSTEM.ADDRESS );

   pragma interface(C,EXT);
   pragma import_procedure(EXT,"EXT",mechanism=>value);

   LOC : CLIST;

begin
   LOC := new FOO;

   LOC.BAR := 5;

   EXT(LOC.all'address);
end ZIP;

-- ext.c

struct foo {
  int bar;
};

ext( p )
   struct foo *p;
{
   printf("p->bar = %d\n", p->bar );
}

-- run.com

$ acs create library [.adalib]
$ acs set library [.adalib]
$ ada zip
$ cc ext
$ acs export/main zip
$ link zip,sys$input/option
	ext.obj
	sys$library:vaxcrtl/share
$ run zip
$ exit

---------------

  This was verified with DecAda v1.3.  for more info see "VAX Ada Programmer's
  Run-Time Reference Manual", section 4.4 "Using the Import and Export
  Pragmas", pages 4-14 to 4-26.  Hope this helps.

Jeff Bartlett
Center for Digital Systems Research		jb@rti.rti.org
Research Triangle Institute, RTP, NC		rti!jb@mcnc	mcnc!rti!jb

> 
> MArk Gerhardt
> ESL, INC
> reply : gerhardt@ajpo.sei.cmu.edu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1989-01-27  3:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-01-26  0:51 bug in DEC compiler?? gerhardt
1989-01-27  3:48 ` Jeff Bartlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox