comp.lang.ada
 help / color / mirror / Atom feed
* Problems Linking With a C++ Lib
@ 2015-11-05 23:57 Aurele
  2015-11-06  0:05 ` Jeffrey R. Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Aurele @ 2015-11-05 23:57 UTC (permalink / 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?


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-11-09 20:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 23:57 Problems Linking With a C++ Lib Aurele
2015-11-06  0:05 ` 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

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