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=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9277635655f37412 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.56.163 with SMTP id b3mr22787417pbq.0.1323094779634; Mon, 05 Dec 2011 06:19:39 -0800 (PST) Path: lh20ni72220pbb.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!newsfeed.straub-nv.de!noris.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 05 Dec 2011 15:19:37 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: POSIX.Semaphores question References: <9jvdbkFdi2U1@mid.individual.net> <2166814f-4a26-4425-965f-2c6215eeedde@d17g2000yql.googlegroups.com> In-Reply-To: <2166814f-4a26-4425-965f-2c6215eeedde@d17g2000yql.googlegroups.com> Message-ID: <4edcd2fa$0$6548$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 05 Dec 2011 15:19:38 CET NNTP-Posting-Host: 7e975d71.newsspool4.arcor-online.net X-Trace: DXC=76DEOjGI4NXaoembcbF;DQ4IUKZLh>_cHTX3j]Cg2C@jUCWJT X-Complaints-To: usenet-abuse@arcor.de Xref: news2.google.com comp.lang.ada:14836 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2011-12-05T15:19:38+01:00 List-Id: On 05.12.11 13:25, awdorrin wrote: > The only thing I do see, is when I add the compile flat to print out > the rep specs - the Semaphore is given two different sizes... > > for SEM_R_RTSIM_SHM_READY'Size use 128; > for SEM_R_RTSIM_SHM_READY'Size use 192; > > It should be 128, not sure why its later showing as 192... from > looking at the definition for sem_t on this linux system, it should be > 128. That's odd. Is this really the same variable (or maybe just the same name)? FWIW, the following program appears to be working as expected, in at least one environment. with Interfaces.C; with Assign_For_Ext_Use; pragma Elaborate_All (Assign_For_Ext_Use); package Exp_Imp is use Interfaces; type C_Compatible is new C.int; With_Convention_Ada : C_Compatible := 16#BEEF#; pragma Export (Ada, With_Convention_Ada, "exp_imp__with_convention_ada"); For_Ext_Use : C_Compatible := C_Compatible(Assign_For_Ext_Use); pragma Export (C, For_Ext_Use, "exp_imp__for_ext_use"); end Exp_Imp; with Interfaces.C; function Assign_For_Ext_Use return Interfaces.C.int is begin return 16#F00#; end Assign_For_Ext_Use; #include #define M(p, name) p ## __ ## name extern int M(exp_imp, with_convention_ada); extern int M(exp_imp, for_ext_use); extern void adainit (void); extern void adafinal (void); int main() { adainit(); fprintf(stderr, "with_convention_ada is %X\n", M(exp_imp, with_convention_ada)); fprintf(stderr, "for_ext_use is %X\n", M(exp_imp, for_ext_use)); adafinal(); return 0; } gnatmake -gnatwa -gnato -O -f exp_imp.ads && \ gnatbind -n exp_imp.ali && \ gnatmake -O -gnato b~exp_imp.adb && \ gcc use_from_c.c b~exp_imp.o assign_for_ext_use.o exp_imp.o \ -o use_from_c -lgnat $ ./use_from_c with_convention_ada is BEEF for_ext_use is F00