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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,1f8050edb14e8329,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z41g2000yqz.googlegroups.com!not-for-mail From: "RasikaSrinivasan@gmail.com" Newsgroups: comp.lang.ada Subject: Interfacing to C Date: Thu, 24 Dec 2009 01:46:05 -0800 (PST) Organization: http://groups.google.com Message-ID: <56284e56-6ac5-427c-8e4f-8a0750527088@z41g2000yqz.googlegroups.com> NNTP-Posting-Host: 98.216.109.119 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1261647970 1005 127.0.0.1 (24 Dec 2009 09:46:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 24 Dec 2009 09:46:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z41g2000yqz.googlegroups.com; posting-host=98.216.109.119; posting-account=mZyFSQoAAABfOmklsh1d8TPbS2LncUKl User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8509 Date: 2009-12-24T01:46:05-08:00 List-Id: I am building an interface to a C library. This library uses structs like the following: typedef struct { x : int ; y : int } MyStruct .... While passing variables of this type to functions, the convention in C is to pass by value (best of my knowledge). however when I import a function like: type MyStruct is record ..... end record ; pragma Convention(C,MyStruct); procedure process(var : MyStruct); pragma Import(C,process); It appears that Ada passes the var by reference. (Well - I am not able to tell for sure - just that modifying the binding as follows : procedure process(varx : int; vary : int); pragma Import(C,process) ; works and the previous binding did not. So the question is - how c(an I force Ada (gnat) to pass a record by value? thanks for pointers, srini