comp.lang.ada
 help / color / mirror / Atom feed
* pragma/aspect Import, Convention parameters
@ 2015-08-13  8:27 Dmitry A. Kazakov
  2015-08-13 10:24 ` G.B.
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Dmitry A. Kazakov @ 2015-08-13  8:27 UTC (permalink / raw)


Why is it an identifier?

For writing portable code it should be a static expression. The problem is
that much too often the exported functions of the same library have
different conventions on different platforms, e.g.

   procedure Foo ...
   pragma Import (C, Foo, "Foo");  -- Linux

   procedure Foo ...
   pragma Import (StdCall, Foo, "_Foo");  -- Windows

The external name is an expression. Thus you could write something like

   pragma Import (..., Foo, Target.External_Name_Prefix & "Foo");

With External_Name_Prefix defined in a single configuration packet Target
to change. But the convention is not an expression.

There certainly are ways to keep it backward compatible, e.g.

   procedure Foo ...
   pragma Import (User, Foo, "Foo", "Stdcall");

   procedure Foo ... with Convention_Name => "StdCall", ...

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

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

end of thread, other threads:[~2015-08-20 16:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13  8:27 pragma/aspect Import, Convention parameters Dmitry A. Kazakov
2015-08-13 10:24 ` G.B.
2015-08-13 11:52   ` Dmitry A. Kazakov
2015-08-13 20:32 ` Randy Brukardt
2015-08-14  7:23   ` Dmitry A. Kazakov
2015-08-14 20:30     ` Randy Brukardt
2015-08-15  1:15       ` Shark8
2015-08-17 21:40         ` Randy Brukardt
2015-08-17 21:47           ` Bob Duff
2015-08-20 16:00           ` Shark8
2015-08-13 23:42 ` David Botton
2015-08-15  5:22   ` gautier_niouzes
2015-08-17 21:54     ` Randy Brukardt
2015-08-20 16:07       ` Shark8

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