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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,afaf6b0b4d015191 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-07 07:06:12 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!proxad.net!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: including C routines in Ada (newbie ask for assistance) Date: Mon, 7 May 2001 10:00:19 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9d69pk$sh$1@nh.pace.co.uk> References: <3af67ee5.9539925@news.nl.uu.net> <3AF68F86.7DA2B0C9@earthlink.net> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 989244020 913 136.170.200.133 (7 May 2001 14:00:20 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 7 May 2001 14:00:20 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: newsfeed.google.com comp.lang.ada:7255 Date: 2001-05-07T14:00:20+00:00 List-Id: Good advice. Its also important to observe that whatever functions are written in C are outside the scope of Ada, and that one needs to figure out the compilation/linking of C code into a callable library strictly from the C perspective. Once you have a callable/linkable file Ada can take over & specify how the Ada program can reach the function. The specifics, of course, are going to be very dependent on the implementations of the two languages. That is to say that two mismatched compilers might never be able to hook code together since there is nothing mandatory about how a C compiler must present its interface {calling sequence & parameter passing} and the Ada compiler attempting to connect to it via pragmas is only going to do so via some specific conventions that it knows about. Gnat will know about the gcc method of interfacing, which is probably the same as what the underlying OS uses for its C-written calls, but with some other compiler at the other end, you get no guarantees. So its important to state what the environment is when trying to figure this stuff out. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Marc A. Criley" wrote in message news:3AF68F86.7DA2B0C9@earthlink.net... > Noam Kloos wrote: > > > > Hi Once I had someone show me how to write routines in C and import > > them into Ada source with pragma Import(....); > > I know how to do a system call pragma import(C,C_System,"system"); but > > how do I access a c source file I have written myself? > > If you're using GNAT, look in the GNAT User Guide in the section on > "Mixed Language Programming/Interfacing to C", and look at the > "use_of_import.adb" example in the GNAT examples directory. >