comp.lang.ada
 help / color / mirror / Atom feed
From: Aurele <aurele.vitali@gmail.com>
Subject: Problems Linking With a C++ Lib
Date: Thu, 5 Nov 2015 15:57:39 -0800 (PST)
Date: 2015-11-05T15:57:39-08:00	[thread overview]
Message-ID: <3ca7150b-f54f-4cd1-82d9-5744cea53aad@googlegroups.com> (raw)

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?


             reply	other threads:[~2015-11-05 23:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 23:57 Aurele [this message]
2015-11-06  0:05 ` Problems Linking With a C++ Lib Jeffrey R. Carter
2015-11-06  0:11   ` Aurele
2015-11-06  0:56     ` Jeffrey R. Carter
2015-11-06  1:27       ` Aurele
2015-11-06  1:59         ` Jeffrey R. Carter
2015-11-06  3:07           ` Aurele
2015-11-06  3:33             ` Jeffrey R. Carter
2015-11-06  3:57               ` Aurele
2015-11-06  4:28               ` Aurele
2015-11-07  3:10                 ` Aurele
2015-11-09 18:35 ` jsquirek
2015-11-09 20:52 ` Aurele
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox