From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,64a6ad02ec510120 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-01 09:12:56 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed.stueberl.de!news2.euro.net!uunet!ash.uu.net!world!news From: Robert A Duff Subject: Re: Interfacing to C library... User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Fri, 1 Nov 2002 17:11:06 GMT Content-Type: text/plain; charset=us-ascii References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30292 Date: 2002-11-01T17:11:06+00:00 List-Id: "Eric G. Miller" writes: > I'm working on building an interface to a C library where most of the > functions are defined as returning a long integer containing the various > error codes returned by each function and data is passed back from the > "functions" via pointer arguments to [usually] structures. Below is > something of a demonstration of what I've come up with, but I'd appreciate > pointers to better approaches. Eventually, I'd like to hide the access > type and handle the error codes another way (exceptions maybe...). First write a "thin" interface, which is as close to the C code as possible. E.g., use a modular type for your error codes, as you did. Then write another package that is "thicker", and takes advantage of Ada features like exceptions. - Bob