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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:3dc6:: with SMTP id n189-v6mr11955151itn.30.1523126100677; Sat, 07 Apr 2018 11:35:00 -0700 (PDT) X-Received: by 2002:a9d:4c99:: with SMTP id m25-v6mr623570otf.6.1523126100528; Sat, 07 Apr 2018 11:35:00 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!k65-v6no899076ita.0!news-out.google.com!u64-v6ni1360itb.0!nntp.google.com!u184-v6no910621ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 7 Apr 2018 11:35:00 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.72.55.22; posting-account=sfUYLwoAAADgN4x5cQtEVb7ua7QwdFn4 NNTP-Posting-Host: 24.72.55.22 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Linking Ada to C++ Overloaded Functions and Methods From: Ron Wills Injection-Date: Sat, 07 Apr 2018 18:35:00 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:51386 Date: 2018-04-07T11:35:00-07:00 List-Id: I know that both Ada and C++ can overload functions and methods. The proble= m I'm having is when I'm trying to link Ada to overload C++ functions. I kn= ow I could use different Ada names, but if it's possible to keep the same n= ames in Ada it would save a lot of re-coding. An example is from the FLTK library. The "draw_box" method from the Fl_Widg= et class is overloaded and I get the following from g++ -fdump-ada-spec. procedure draw_box (this : access constant Fl_Widget'Class); pragma Import (CPP, draw_box, "_ZNK9Fl_Widget8draw_boxEv"); procedure draw_box (this : access constant Fl_Widget'Class; t : Fl_Enumerations_H.Fl_Boxtype; c : Fl_Enumerations_H.Fl_Color); -- /usr/include/Fl/Fl_Widget.H:181 pragma Import (CPP, draw_box, "_ZNK9Fl_Widget8draw_boxE10Fl_Boxtypej"); The C++ name mangling works to uniquely identify the C++ methods, but the c= ompiler is choking on the Ada names as already being declared. fl_fl_widget_h.ads:171:07: entity "draw_box" was previously imported fl_fl_widget_h.ads:171:07: (pragma "Import" applies to all previous entitie= s) fl_fl_widget_h.ads:171:07: import not allowed for "draw_box" declared at li= ne 164 fl_fl_widget_h.ads:181:07: entity "draw_box" was previously imported fl_fl_widget_h.ads:181:07: (pragma "Import" applies to all previous entitie= s) fl_fl_widget_h.ads:181:07: import not allowed for "draw_box" declared at li= ne 167 Is there a way to use overloaded Ada names with C++ or do I need to find a = unique Ada name for every C++ overload method?