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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8f1dd1c22d4d88cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-07 11:10:34 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!green.octanews.net!news-out.octanews.net!news.glorb.com!logbridge.uoregon.edu!arclight.uoregon.edu!wn52feed!worldnet.att.net!attbi_s51.POSTED!not-for-mail From: "Jeff C," Newsgroups: comp.lang.ada References: Subject: Re: import errors X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1078686633 24.147.74.171 (Sun, 07 Mar 2004 19:10:33 GMT) NNTP-Posting-Date: Sun, 07 Mar 2004 19:10:33 GMT Organization: Comcast Online Date: Sun, 07 Mar 2004 19:10:33 GMT Xref: archiver1.google.com comp.lang.ada:6124 Date: 2004-03-07T19:10:33+00:00 List-Id: "Szymon Guz" wrote in message news:c2frbi$ac$1@nemesis.news.tpi.pl... > Hi, > I'm trying to make a binding to a dll library written in C++ and I'va > got a problem. I have two types in one package and two procedures that > are named the same: > > type A; > type B is new A; > > procedure A(this:A_Access); > procedure A(this:B_Access); > > and now I want to import them from the dll library, but writing sth like > this: > > pragma Import(C,A,"AAA"); > pragma Import(C,A,"BBB"); > > generates some compiler errors, so I tried to do it in this way: > the body of the procedures looks like this: > > procedure A(this:A_Access) is > procedure THIS_A(this:A_Access); > pragma Import(C,THIS_A,"AAA"); > begin > THIS_A(this); > end; > > procedure A(this:B_Access) is > procedure THIS_A(this:B_Access); > pragma Import(C,THIS_A,"BBB"); > begin > THIS_A(this); > end; > > I thought that it should work fine, but now I see that there is a > compiler error which I don't undestand: > > undefined reference to 'AAA' > > So i've got two questions: > what do I do wrong that I cannot import the functions in the *.adb file > and I can in the *.ads file ? > how can I import the functions ? I am confused. At the end of your post you indicate that you cannot import the functions in the .adb but you can in the .ads file? But you don't show any examples of it. The one error you are posting something (almost) specific for is undefined reference to 'AAA' which if I am guessing correctly is not a compiler error at all but is a linker error since it can not find the symbol AAA. 1) Do you know for sure the linker name of the procedure you want is AAA? 2) Are you doing something (pragmas or linker switches to include a library file that would contain this symbol? 3) You appear to be trying to bind to C++ (v.s. C) which is not very well defined (i.e. There is no pragma Import(C++, X,X) in the LRM). Have you done something in your C++ code to export the code to C to make this rational?