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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bd85303b24b257e2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-04 09:31:41 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!news.uh.edu!uuneo.neosoft.com!blkbox.COM!not-for-mail From: harvey@blkbox.COM (Greg Harvey) Newsgroups: comp.lang.ada Subject: Re: Calling C++ from within ADA Date: 4 Nov 1994 11:31:41 -0600 Organization: The Black Box, Houston, Tx (713) 480-2686 Message-ID: <39dr5t$lm9@blkbox.blkbox.COM> References: NNTP-Posting-Host: blkbox.com X-Newsreader: NN version 6.5.0 #3 (NOV) Date: 1994-11-04T11:31:41-06:00 List-Id: ka@socrates.hr.att.com (Kenneth Almquist) writes: >CVANOVER@bamanet.ua.edu wrote: >> Is there a way to call a C++ procedure from within ADA? I can call a C >> procedure with >> >> package C_LIB is >> procedure clear_screen; >> procedure sleep_a_moment; >> private >> pragma interface(c,clear_screen); >> pragma interface(c,sleep_a_moment); >> end C_LIB; >> >> However, when I compile the same C procedure in C++ [things don't work]. >Change the interface pragmas to tell the Ada compiler that the >procedures are C++ procedures rather than C procedures. If you can't >do this becuase your Ada compiler doesn't know about C++, add the >following to your C++ code: >extern "C" void clear_screen(void); >extern "C" void sleep_a_moment(void); >This will tell the C++ compiler to use C calling conventions for these >procedures. > Kenneth Almquist Isn't this where the people who like to complain about object-based languages with no static binding start showing up? ;) Greg Harvey (harvey@blkbox.com)