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: 103376,73975695cdfcb86f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.235.4 with SMTP id ui4mr9593589pbc.3.1333464169522; Tue, 03 Apr 2012 07:42:49 -0700 (PDT) Path: r9ni14043pbh.0!nntp.google.com!news2.google.com!postnews.google.com!x17g2000vba.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Dispatching callback handed over to C Date: Tue, 3 Apr 2012 07:42:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <85d1ad51-c02b-44fa-87b6-02aa1d8ba1b2@x17g2000vba.googlegroups.com> References: <6fb83c74-b2a4-4ae8-9c89-d755b737198f@v22g2000vby.googlegroups.com> NNTP-Posting-Host: 213.77.7.66 Mime-Version: 1.0 X-Trace: posting.google.com 1333464169 7476 127.0.0.1 (3 Apr 2012 14:42:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 3 Apr 2012 14:42:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x17g2000vba.googlegroups.com; posting-host=213.77.7.66; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-04-03T07:42:49-07:00 List-Id: On 3 Kwi, 14:02, Natasha Kerensikova wrote: > But still, I can't help but think there is one needless subprogram call > in that solution. With a way to obtain the address of the actual > subprogram the dispatching call would dispatch to, the address could be > handed over to C code so that it can call it directly. Then the target operation would need to have a C calling convention. Since one of the reasons to do OO is to allow users to extend the system with new operations (new implementations), this requirement would be a limitation. The indirection allows to completely isolate the user from such details. > Actually it uses the assumption that System.Address and void* have the > same representation. > > I wonder how reliable the assumption is. Whenever Ada and C (or C++) components are linked together, a set of "friendly" compilers is needed, so that basic binary compatibility can be guaranted - otherwise nothing is going to work at all, not even Interfaces.C.int. :-) This assumption is pretty safe. -- Maciej Sobczak * http://www.inspirel.com