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 10.31.170.17 with SMTP id t17mr8791484vke.2.1446767859867; Thu, 05 Nov 2015 15:57:39 -0800 (PST) X-Received: by 10.182.196.9 with SMTP id ii9mr159130obc.7.1446767859820; Thu, 05 Nov 2015 15:57:39 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!m48no5535656qgd.0!news-out.google.com!z4ni71ign.0!nntp.google.com!i2no28645igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 5 Nov 2015 15:57:39 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.26.108.144; posting-account=gOYTTAoAAADrNEg_oe5Etelo-0qd7UeW NNTP-Posting-Host: 70.26.108.144 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3ca7150b-f54f-4cd1-82d9-5744cea53aad@googlegroups.com> Subject: Problems Linking With a C++ Lib From: Aurele Injection-Date: Thu, 05 Nov 2015 23:57:39 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 2187 X-Received-Body-CRC: 645728339 Xref: news.eternal-september.org comp.lang.ada:28223 Date: 2015-11-05T15:57:39-08:00 List-Id: Hi all, I've developed a DirectInput Windows wrapper library in C and I'm trying to link it with an Ada main (Adacore GPS environment) but I keep getting the following error: undefined reference to `DI_InitDirectInput@8' I used C to develop this wrapper because its uses DirectX "API Methods" which is not supported in Ada (well at least I think its not). The wrapper is simple and implemented using MS Visual Studio. Here is the C code sample: extern "C" { int DI_InitDirectInput( HWND hWnd, HINSTANCE hInstance ); int DI_InitDirectInput( HWND hWnd, HINSTANCE hInstance ) { ... }; } In Ada, I've created the following spec for the library: package DI is function DI_InitDirectInput( hW : hWnd; hInst : hInstance ) return Bool; private pragma import( C, DI_InitDirectInput, "DI_InitDirectInput" ); end DI; I use the following linker switches when building the main body: package Linker is for Default_Switches ("ada") use ( "-LE:\Lib", "-lDirectInput" ); end Linker; GPS (or the builder) finds the library but not the reference. The library works well if I use the ObjectAda IDE to build the main. Any thoughts?