comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Using Gnat.Sockets in a Windows DLL
Date: Wed, 9 Dec 2015 13:33:52 +0100
Date: 2015-12-09T13:33:52+01:00	[thread overview]
Message-ID: <1sf56oi455q43$.12pn269dkkl8p$.dlg@40tude.net> (raw)
In-Reply-To: ebd3d78a-090b-463c-9135-865a279b6ba6@googlegroups.com

On Wed, 9 Dec 2015 04:02:13 -0800 (PST), ahlan@marriott.org wrote:

> We have to set encapsulated otherwise GprBuild complains
> shared library project "monitor" cannot import static library project "win32ada"

This is because you forgot to select the "relocatable" scenario for
win32ada. E.g. when using gprbuild:

   grpbuild -P... -XWIN32ADA_BUILD=relocatable

There is a static build of win32ada which is the default scenario.

 E.g.
----- test.gpr >>>>>>>>>>>
with "win32Ada.gpr";
library project Test is
   for Library_Name use "test";
   for Library_Kind use "dynamic";
   for Library_Dir  use "c:/temp";
   for Library_Interface use ("test"); 
   for Library_Standalone use "standard";
end Test;
----- test.gpr <<<<<<<<<<<

---- test.adb >>>>>>>>>>>
with GNAT.Sockets;  use GNAT.Sockets;
with Win32;         use Win32;
with Win32.WinBase; use Win32.WinBase;
with Win32.WinNT;   use Win32.WinNT;

function Test return String is
   Self : HANDLE;
begin
   Self := GetCurrentProcess; -- Windows API call
   return Host_Name; -- GNAT.Sockets call
end Test;
---- test.adb <<<<<<<<<<<

gprbuild -d -PC:\Temp\Z\test.gpr -XWIN32ADA_BUILD=relocatable
gcc -c test.adb
gprlib.exe test.lexch
gnatbind -n -o b__test.adb -Ltest -a C:\Temp\Z\test.ali
gcc.exe -c -x ada -gnatA -gnatws b__test.adb -o b__test.o ...
gcc.exe -shared -shared-libgcc -o C:\temp\libtest.dll ... C:\Temp\Z\test.o
...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2015-12-09 12:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  7:56 Using Gnat.Sockets in a Windows DLL ahlan
2015-11-26  8:39 ` Dmitry A. Kazakov
2015-12-08  7:43 ` ahlan
2015-12-08  9:52   ` Dmitry A. Kazakov
2015-12-09  7:20 ` ahlan
2015-12-09  9:20   ` Dmitry A. Kazakov
2015-12-09 12:02 ` ahlan
2015-12-09 12:33   ` Dmitry A. Kazakov [this message]
2015-12-09 15:06 ` ahlan
2015-12-09 15:58   ` Dmitry A. Kazakov
2015-12-09 19:11   ` Simon Wright
2015-12-11 17:53 ` ahlan
2015-12-12 12:47   ` Simon Wright
2015-12-12 19:44     ` ahlan
2015-12-12 20:38       ` Simon Wright
2015-12-24 14:46 ` ahlan
2015-12-25 11:09   ` Simon Wright
2016-01-13 20:25 ` ahlan.marriott
2016-04-20 17:10   ` Dmitry A. Kazakov
2016-04-23  9:24     ` ahlan.marriott
replies disabled

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