comp.lang.ada
 help / color / mirror / Atom feed
From: Vim Pine 44 <research@ada95.ijs.co.nz>
Subject: Re: GNAT and NT DLL; An Ada-Comment resignation
Date: Tue, 08 Jan 2002 15:48:34 GMT
Date: 2002-01-08T15:48:34+00:00	[thread overview]
Message-ID: <vu4m3u8dtigdb5d0vusq4qkur72uibicnd@4ax.com> (raw)
In-Reply-To: xUj_7.7182$cD4.11101@www.newsranger.com





On Mon, 07 Jan 2002 16:19:41 GMT, Ted Dennison wrote:



Below I quote some of the latest messages sent to the Ada-Comment
mailing list, of R. R. Software's Mr Brukardt. This covers the events
leading up to the about-to-occur unsubscribing of Mr R. Dewar.

Firstly about the -k option of gnatdll / dlltool and how to edit the
*.def definition files allowing use of Windows NT Service Pack DLLs.

>In article <mailman.1010276762.30835.comp.lang.ada@ada.eu.org>, Alexandre
>E. Kopilovitch says...
>
>>Because with that Link_Name the suffix "@nn" is still appended. As the
>>GNAT User's Guide honestly says (at the end of Microsoft Windows
>>Topics/Windows Calling Conventions/Stdcall Calling Convention section):
>>"... there is no trailing underscore but the appropriate @nn is always
>>added at the end of the Link_Name by the compiler. "
>
>... [...]If you feed "External_Name" the exact same name and convention
>that the C header file uses, then you ought to be receiving the same
>thing that the C header file receives. I don't understand why that isn't
>working for you, assuming you are linking in the same library files.


----------
On Sat,  5 Jan 2002 01:04:04 +0300 (MSK), "Alexandre E. Kopilovitch"
 wrote:
>[...] GNAT 3.13p on Windows, and some apparently exotic foreign DLL,
>which was written in C or C++ and now should be called from an Ada
>program. The problem appears to be with the combination of the call
>convention and the names of the DLL's entry points: the call convention
>is surely Stdcall, but the entry point names do not contain usual
>suffixes "@nn" - they look as common C identifiers.
---------


[1] Linking in Microsoft Service Pack DLLs into a GNAT program

The "External_Name" and "Link_Name" options are documented here, in
the AARM Annotated Reference Manual:

   http://www.ada-auth.org/arm-html/AA-B-1.html

I suppose the first author of the thread was right in saying that both
of those options do not resolve the problem.

A GNAT for Windows NT program links into a DLL after it gets the *.a
file that was created from the DLL.

By using the dlltool.exe's '--kill-at' option of the equivalent '-k'
option of maybe-ACT's gnatdll.exe, the problem can be fixed.

The linker says "@nn" suffixes should be added, and the way to achieve
that is to use the gnatdll '-k' option to add the suffixes the linker
requires. Maybe that is not right since the gnatdll says the '-k'
feature does this:  "-k   Remove @nn suffix from exported names".

An example showing use of '-k'

   $ dll2def API.dll > API.def
   $ gnatdll -k -e API.def -d API.dll

If a DLL contains a mix of Cdecl and Stdcall subroutines, or bcc32
is used, etc., then the *.def file can be edited.

A sample *.def file that is used by gnatdll/dlltool:

LIBRARY newdll.dll
EXPORTS
   _bccsub
   bccsub=_bccsub
   ntsub
   ntsub@0=ntsub

If the linker says that ntsub@00 is needed, and a use of dumbin.exe
(of Visual C, or of the Aonix compiler) says that the entry in the
DLL is "ntsub" then a line "ntsub@0=ntsub" could be added to the
*.def file. The @nn can be copied from the error messages of the
linker. Once the *.def file is edited correctly then there is no

The *.1 documentation of dlltool does not explain much on *.def
files and how to edit them.

The "LIBRARY" line can help Windows NT get the name of the DLL right.

A way to check for the smashing up of memory that can result from
wrongly using Cdecl to call a Stdcall DLL, is to add a 500 byte
array to the variables of the subroutine having a line making the
improperly mixed call. 

A place that looks like it might document tips and methods for
getting Ada code running smoothly with other compilers, could be:
http://www.adapower.com/
There is a shortage of how to pages there.

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

[2] On the topic: "Is it best to use GCC?."

The MinGW website seems to say no. Some text copied from a
webpage of the mingw.org website's FAQ page:

http://www.mingw.org/mingwfaq.shtml

>There is command-line option that can be passed to Cygwin's
>GCC, "-mno-cygwin", that was intended to address these
>concerns [about copyright and the need to pay Red Hat or else
>release code]. When Cygwin's GCC is invoked with the "-mno-
>cygwin" option, executables are built without a dependency on
>the Cygwin DLL. Instead, the "-mno-cygwin" option instructs
>GCC to use the MinGW headers and libraries (which must be
>located in a particular location within the Cygwin directory
>structure). However, support for "-mno-cygwin" has been weak
>and flaky... the location at which it searches for MinGW
>headers has changed a time or two (with poor documentation),
>bugs have crept in, and maintainence of the option has NOT be
>a priority in development. There is a distinct possibility
>that "-mno-cygwin" will become depreciated in future releases
>of Cygwin.

MinGW executables are smaller than gcc executables. If gcc code
runs than it is not flakey. All of gcc/mingw/bcc32 are no good
at compiling kernel mode drivers.

ACT has reservations about Cygwin Gcc too. This is from a message
that I got from ACT after sending in a request about the free Ada
code that people could not compile.

-------------------------------------
At 2001.12.26 11:28 -0500 Wednesday, dewar@gnat.com wrote:
><<I request that ACT put online information that says how to compile
> the gcc.gnu.org gcc/gcc/ada code in windows NT.
>I.e. for people with GNAT 3.13p installed and maybe Cygwin Gcc.
>>>
>
>We advise against any use of Cygwin GCC, and do not support the use
>of GNAT with Cygwin. That being said, you may be able to successfully
>build a version, and if so, that's just fine with us, but it's not
>something we have done or intend to do.
>
>As for more information, we have no plans at the current time,
>several people have built gcc successfully on NT, but indeed it is
>tricky [could be wrong], requiring [...] hopefully people [...]
-------------------------------------

GNAT Pro users ought be able to get the compiler compiled. Are they
barred a little bit by an agreement with ACT?.

Maybe ACT's Mr Dewar was hinting that MinGW is better than GCC for
Windows NT GNAT user app programs. Anybody got data on that topic?.

Successes at compiling the public GNAT ought appear here
sometime: http://gcc.gnu.org/ml/gcc/

Getting the files:
WinCVS: http://www.devguy.com/fp/cfgmgmt/tools/install.htm
  (Cygwin CVS produces defective Entries files).

$ cvs -d:pserver:anoncvs@gcc.gnu.org:/cvs/gcc login
     (password is ``anoncvs'')
$ cvs -z7 -d:pserver:anoncvs@gcc.gnu.org:/cvs/gcc co -c
     List all the modules and see what groups of files are available.
$ cvs -z7 -d:pserver:anoncvs@gcc.gnu.org:/cvs/gcc co gcc-ada



====================================================================

[3] Quality of discussions at the Ada-Comment list and where to draw
the line over excluding the interests of readers that woudld be
conversational

The topic is one seen from time to time: requesting the thread vanish
and go maybe to comp.lang.ada.

It starts out with a personal message going to a public mailing list,
which seems to be a mistake.


-1--------------------------------------------------------------------

Received: (from ploedere@localhost)
	by ibsen.informatik.uni-stuttgart.de (8.9.3+Sun/8.9.1) id
PAA01857;
	Mon, 7 Jan 2002 15:08:52 +0100 (MET)
Date: Mon, 7 Jan 2002 15:08:52 +0100 (MET)
From: Erhard Ploedereder <ploedere@informatik.uni-stuttgart.de>
To: ada-comment@ada-auth.org
In-reply-to: <000f01c17c54$34e7fb40$0604a8c0@bigboy.rrsoftware.com>
	(Randy@RRSoftware.Com)
List-Server: DOLIST Server Custom 3.4 B2110
List-Help: <mailto:listserv@ada-auth.org?body=help%20ada-comment>
List-Subscribe: <mailto:listserv@ada-auth.org?body=join%20ada-comment>
List-Info: Ada-Comment list
Subject: Re: [Ada-Comment] OT: Request for articles for the AdaIC
site.

Randy,

on a somewhat related topic....a few students of mine have been
searching the net for Ada Software that uses tagged types, i.e. 
the OO-features of Ada and haven't been very successful. 

Any pointers that you might have ?

Erhard

-2--------------------------------------

From: dewar@...
To: ada-comment@ada-aut...
Date: Mon,  7 Jan 2002 11:16:49 -0500 (EST)
Subject: Re: [Ada-Comment] User-defined conversions (or constructors)?

Pascal, I am afraid you do not qualify as an Ada user :-)

[...]

In fact I think Ada comment should NOT be used for general discussions
on ideas, but rather for submissions of ideas, and the discussions
should take place elsewhere, either on CLA for general chat, or on 
the ARG list for serious language work.

There is a danger of comment becoming an Ada chit chat list, in which
case we will need to constitute another separate formal list for
language suggestions and comments on the standard.

-3--------------------------------------

Date: Mon,  7 Jan 2002 17:25:17 -0500 (EST)
To: ada-comment@ada-auth.org
Subject: Re: [Ada-Comment] OT: Request for articles for the AdaIC
 site.

Surely discussion of availability of student materials on Ada does
not belong on the official mailing list for comments on the ISO
standard!.

-4--------------------------------------

From: "Randy Brukardt" <Randy@RR...
To: "'Ada-Comment List'" <ada-comment@ada-aut...
Date: Mon, 7 Jan 2002 16:50:58 -0600

** Brukardt:
  Oops, sorry, I just pushed reply
[...]
I don't agree. The original intent of the ARG list was for
 administrative issues (i.e. meeting announcements and agendas --
 technical discussion was supposed to occur on Ada Comment. And I
 think technical discussion ought to be recorded for posterity -- else
 we're liable to have the same discussions over and over.

So, as a practical matter, the amount of administrative work is the
 same whether the discussion occurs on ARG or on Ada Comment, the only
 difference being that we are more likely to ignore (rather than
 record) discussions on ARG that have obvious answers. There aren't
 many such discussions.

I'm really against using CLA for anything important.
[imperfect Usenet access (bad ISPs). CC.]

So, I'd rather see the technical discussion on Ada-Comment. Which also
 has the advantage of being available to the general public, while ARG
 is closed.
Of course, off-topic stuff and chit-chat should be minimized. I block
 a lot of those messages here before they even go to the list [...]

		Randy Brukardt
		ARG Editor

-5--------------------------------------

From: dewar@gnat.com
Date: Mon,  7 Jan 2002 18:18:38 -0500 (EST)
List-Subscribe: <mailto:listserv@ada-auth.org?body=join%20ada-comment>
Subject: Re: [Ada-Comment] OT: Request for articles for the AdaIC
site.

OK, given Randy's feeling, I am unsubscribing, so silence from me on
this issue simply means I am not seeing any more traffic :-)
I definitely do not want to be on yet another random Ada chat mailing
list

----------------------------------------------------------------------
[end]


A re-shooting could produce a different ending.

List members did not add to the thread except for one that cited
projects that had used the tagged type.

The list: Ada-Comment: http://www.adaic.org/standards/ada95.html

My list of other Ada Lists: http://www.ijs.co.nz/ada_95.htm
Cetus-Links' page: http://www.cetus-links.org/oo_ada.html

Educators can write to the Ada First mailing list. Team-Ada readers
not get less messages saying 'my university prefers Java ... or C'.

  http://osgood.seas.gwu.edu/cgi-bin/lyris.pl  ('Special Topics')




Craig Carey







  reply	other threads:[~2002-01-08 15:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-06  0:31 GNAT and a very foreign DLL Alexandre E. Kopilovitch
2002-01-07 16:19 ` Ted Dennison
2002-01-08 15:48   ` Vim Pine 44 [this message]
2002-01-09 10:20     ` GNAT and NT DLL; An Ada-Comment resignation Pascal Obry
2002-01-09 17:59       ` Craig Carey
2002-01-10  2:10     ` Robert Dewar
2002-01-12 18:01       ` Craig Carey
replies disabled

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