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,c348430b94ced675 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-13 13:10:01 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!dispose.news.demon.net!news.demon.co.uk!demon!pogner.demon.co.uk!zap!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Exporting generic's and tagged types Date: 13 Apr 2001 07:13:07 +0100 Organization: CodeFella Message-ID: References: <3AD155BF.E771B7E8@worldnet.att.net> NNTP-Posting-Host: localhost X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 987192467 nnrp-13:17848 NO-IDENT pogner.demon.co.uk:158.152.70.98 X-Complaints-To: abuse@demon.net NNTP-Posting-Date: 13 Apr 2001 06:13:07 GMT X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: supernews.google.com comp.lang.ada:6871 Date: 2001-04-13T06:13:07+00:00 List-Id: Stephen Leake writes: > You can put a "pragma Export (C, ...)" in the generic package > itself, so that when it is instantiated, the appropriate things are > exported. > > Does that do what you want? > > One problem with this scheme is the C name. If you specify it > explicitly in the pragma Export, you cannot instantiate the package > twice (you'll get link time collisions). On the other hand, if you > do not specify it explicitly, you have a compiler dependency. You can (in GNAT, anyway) supply a computed string for pragma Import: -- This string is used to prefix the C names of system calls in the -- imported C functions below. If empty, you get the actual system call -- (open(), etc); you can set it to "bp_" to access the corresponding -- versions in the file bp.c, which either report the call and pass it on -- to the real system interface or (if compiled with SIMULATE_DEVICE -- defined) provide a simple simulation. Import_Prefix : constant String := ""; .... function Open (Path : Interfaces.C.Strings.Chars_Ptr; Oflag : Interfaces.C.Unsigned) return Interfaces.C.Int; pragma Import (C, Open, Import_Prefix & "open");