comp.lang.ada
 help / color / mirror / Atom feed
* Using Functions of Executable
@ 2007-11-22  9:18 Alexander Camek
  2007-11-22 10:18 ` Dirk Heinrichs
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Alexander Camek @ 2007-11-22  9:18 UTC (permalink / raw)


Hi all,

I have got an executable generated with gnatmake. And a lot of modules using 
some functions of the executable. Now all these modules are generated as 
libraries and used during run-time. Okay this works fine under Linux, but 
under Windows i got stucked.

My Problem is that I can't export the functions given in my executable, 
although all exported functions in the executable are decorated with pragma 
Export(C, <Funktion>, <Symbolname>).

What I have tried is to 
use -Wl,--export-dynamics,--out-implib,<Executable-name>.lib, but with this 
option i don't get any .lib file to link my Dll against. And if i use the 
opiton -Wl,--export-all-symbols every symbol even not from libraries my 
executable is linked against. I also combined the last option 
with -Wl,--exclude-libs,ALL but that doesn't help. Extend to that I now, 
that all works fine with .gpr files, there i only use the first linker 
option. But I don't want to use them anymore, to make the build more 
transparent.

Anybody an idea. I am really stucked.

Thanks to all.

Greetings

Alexander 





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

* Re: Using Functions of Executable
  2007-11-22  9:18 Using Functions of Executable Alexander Camek
@ 2007-11-22 10:18 ` Dirk Heinrichs
  2007-11-26 11:15 ` Frank Piron
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Dirk Heinrichs @ 2007-11-22 10:18 UTC (permalink / raw)


Alexander Camek wrote:

> I have got an executable generated with gnatmake. And a lot of modules
> using some functions of the executable. Now all these modules are
> generated as libraries and used during run-time. Okay this works fine
> under Linux, but under Windows i got stucked.
>
> Anybody an idea. I am really stucked.

Separate those functions into a library, maybe?

HTH...

        Dirk
-- 
Dirk Heinrichs          | Tel:  +49 (0)162 234 3408
Configuration Manager   | Fax:  +49 (0)211 47068 111
Capgemini Deutschland   | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68      | Web:  http://www.capgemini.com
D-40468 Düsseldorf      | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net



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

* Re: Using Functions of Executable
  2007-11-22  9:18 Using Functions of Executable Alexander Camek
  2007-11-22 10:18 ` Dirk Heinrichs
@ 2007-11-26 11:15 ` Frank Piron
  2007-11-26 13:07   ` Alexander Camek
  2007-11-27 13:08 ` Alexander Camek
  2007-11-29 10:36 ` Alexander Camek
  3 siblings, 1 reply; 12+ messages in thread
From: Frank Piron @ 2007-11-26 11:15 UTC (permalink / raw)


Am 22.11.2007, 10:18 Uhr, schrieb Alexander Camek  
<Alexander.Camek@Elektrobit.com>:

> My Problem is that I can't export the functions given in my executable,
> although all exported functions in the executable are decorated with  
> pragma
> Export(C, <Funktion>, <Symbolname>).

Try: Export(Stdcall, <Funktion>, <Symbolname>)

Frank Piron



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

* Re: Using Functions of Executable
  2007-11-26 11:15 ` Frank Piron
@ 2007-11-26 13:07   ` Alexander Camek
  2007-11-27  9:56     ` Frank Piron
  2007-11-28  8:59     ` Stephen Leake
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Camek @ 2007-11-26 13:07 UTC (permalink / raw)


Hi,

>> My Problem is that I can't export the functions given in my executable,
>> although all exported functions in the executable are decorated with 
>> pragma
>> Export(C, <Funktion>, <Symbolname>).
>
> Try: Export(Stdcall, <Funktion>, <Symbolname>)

Will that work under linux, too?
Because I need it platform independent.

Greetings

Alexander 





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

* Re: Using Functions of Executable
  2007-11-26 13:07   ` Alexander Camek
@ 2007-11-27  9:56     ` Frank Piron
  2007-11-27 17:11       ` Pascal Obry
  2007-11-28  8:59     ` Stephen Leake
  1 sibling, 1 reply; 12+ messages in thread
From: Frank Piron @ 2007-11-27  9:56 UTC (permalink / raw)


  26.11.2007, 14:07 Uhr, schrieb Alexander Camek  
<Alexander.Camek@Elektrobit.com>:

> Hi,
>
>>> My Problem is that I can't export the functions given in my executable,
>>> although all exported functions in the executable are decorated with
>>> pragma
>>> Export(C, <Funktion>, <Symbolname>).
>>
>> Try: Export(Stdcall, <Funktion>, <Symbolname>)
>
> Will that work under linux, too?
> Because I need it platform independent.

No. Unfortunately creating shared libraries depends on the OS.



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

* Re: Using Functions of Executable
  2007-11-22  9:18 Using Functions of Executable Alexander Camek
  2007-11-22 10:18 ` Dirk Heinrichs
  2007-11-26 11:15 ` Frank Piron
@ 2007-11-27 13:08 ` Alexander Camek
  2007-11-29 10:36 ` Alexander Camek
  3 siblings, 0 replies; 12+ messages in thread
From: Alexander Camek @ 2007-11-27 13:08 UTC (permalink / raw)


Okay, after some further investigation, I have found out that the linker, 
especially gnatlink is getting too much information.

I saw that in calling gnatlink, which invokes gnat1 -- the front-end --, 
there are too much object files.
How can I avoid this.

former call:
gnatmake -P foo.gpr

now i want to do this:

gnatmake foo.adb

In foo.gpr I have got a 'with' to point to source files of a library bar.
Now from this library this object files are linked to my executable.

Is there a switch for gnatmake?
Or what is gnatmake doing when it is invoked with project files in diference 
to a normal invokation?

Thanks for any help

Greetings

Alexander 





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

* Re: Using Functions of Executable
  2007-11-27  9:56     ` Frank Piron
@ 2007-11-27 17:11       ` Pascal Obry
  2007-11-28 10:57         ` Alexander Camek
  2007-11-28 12:04         ` Martin Krischik
  0 siblings, 2 replies; 12+ messages in thread
From: Pascal Obry @ 2007-11-27 17:11 UTC (permalink / raw)
  To: Frank Piron

Frank Piron a ï¿œcrit :
>  26.11.2007, 14:07 Uhr, schrieb Alexander Camek
> <Alexander.Camek@Elektrobit.com>:
> 
>> Hi,
>>
>>>> My Problem is that I can't export the functions given in my executable,
>>>> although all exported functions in the executable are decorated with
>>>> pragma
>>>> Export(C, <Funktion>, <Symbolname>).
>>>
>>> Try: Export(Stdcall, <Funktion>, <Symbolname>)
>>
>> Will that work under linux, too?
>> Because I need it platform independent.
> 
> No. Unfortunately creating shared libraries depends on the OS.

Yes it will, RTFM :) Stdcall will be translated as C convention on
GNU/Linux.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Using Functions of Executable
  2007-11-26 13:07   ` Alexander Camek
  2007-11-27  9:56     ` Frank Piron
@ 2007-11-28  8:59     ` Stephen Leake
  1 sibling, 0 replies; 12+ messages in thread
From: Stephen Leake @ 2007-11-28  8:59 UTC (permalink / raw)


"Alexander Camek" <Alexander.Camek@Elektrobit.com> writes:

> Hi,
>
>>> My Problem is that I can't export the functions given in my executable,
>>> although all exported functions in the executable are decorated with 
>>> pragma
>>> Export(C, <Funktion>, <Symbolname>).
>>
>> Try: Export(Stdcall, <Funktion>, <Symbolname>)
>
> Will that work under linux, too?
> Because I need it platform independent.

The conventions supported by export are defined by the compiler.

So you need to read the user's guide for the compiler you will be
using on all of the platforms you need to support.

It is likely that the conventions will differ, in which case you need
to use a tool similar to gnatprep to choose the convention for the
target compiler.

-- 
-- Stephe



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

* Re: Using Functions of Executable
  2007-11-27 17:11       ` Pascal Obry
@ 2007-11-28 10:57         ` Alexander Camek
  2007-11-28 12:04         ` Martin Krischik
  1 sibling, 0 replies; 12+ messages in thread
From: Alexander Camek @ 2007-11-28 10:57 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 865 bytes --]


"Pascal Obry" <pascal@obry.net> wrote in message 
news:474C4FCF.70202@obry.net...
> Frank Piron a �crit :
>>  26.11.2007, 14:07 Uhr, schrieb Alexander Camek
>> <Alexander.Camek@Elektrobit.com>:
>>>>> My Problem is that I can't export the functions given in my 
>>>>> executable,
>>>>> although all exported functions in the executable are decorated with
>>>>> pragma
>>>>> Export(C, <Funktion>, <Symbolname>).
>>>>
>>>> Try: Export(Stdcall, <Funktion>, <Symbolname>)
>>>
>>> Will that work under linux, too?
>>> Because I need it platform independent.
>>
>> No. Unfortunately creating shared libraries depends on the OS.
>
> Yes it will, RTFM :) Stdcall will be translated as C convention on
> GNU/Linux.

Thanks.
Seems that I have missed to read that little note at the end of that 
chapter.

But this doesn't fix my initial problem.

Greetings

Alexander 





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

* Re: Using Functions of Executable
  2007-11-27 17:11       ` Pascal Obry
  2007-11-28 10:57         ` Alexander Camek
@ 2007-11-28 12:04         ` Martin Krischik
  2007-11-28 13:12           ` Pascal Obry
  1 sibling, 1 reply; 12+ messages in thread
From: Martin Krischik @ 2007-11-28 12:04 UTC (permalink / raw)


Pascal Obry schrieb:
> Frank Piron a écrit :
>>  26.11.2007, 14:07 Uhr, schrieb Alexander Camek
>> <Alexander.Camek@Elektrobit.com>:
>>
>>> Hi,
>>>
>>>>> My Problem is that I can't export the functions given in my executable,
>>>>> although all exported functions in the executable are decorated with
>>>>> pragma
>>>>> Export(C, <Funktion>, <Symbolname>).
>>>> Try: Export(Stdcall, <Funktion>, <Symbolname>)
>>> Will that work under linux, too?
>>> Because I need it platform independent.
>> No. Unfortunately creating shared libraries depends on the OS.
> 
> Yes it will, RTFM :) Stdcall will be translated as C convention on
> GNU/Linux.

And No: not all targets support the creation of DLL's.

Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



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

* Re: Using Functions of Executable
  2007-11-28 12:04         ` Martin Krischik
@ 2007-11-28 13:12           ` Pascal Obry
  0 siblings, 0 replies; 12+ messages in thread
From: Pascal Obry @ 2007-11-28 13:12 UTC (permalink / raw)
  To: Martin Krischik

Martin Krischik a écrit :

> And No: not all targets support the creation of DLL's.

The question was about Windows Stdcall on GNU/Linux. So I repeat yes it
will work.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Using Functions of Executable
  2007-11-22  9:18 Using Functions of Executable Alexander Camek
                   ` (2 preceding siblings ...)
  2007-11-27 13:08 ` Alexander Camek
@ 2007-11-29 10:36 ` Alexander Camek
  3 siblings, 0 replies; 12+ messages in thread
From: Alexander Camek @ 2007-11-29 10:36 UTC (permalink / raw)


Hi Group,

The initial problem was that when I call gnatmake with only my 
main_programm.adb then there too much exported symbols in my .lib.
These symbols wasn't only symbols from my own libraries, the .lib file also 
contained a lot of system libraries symbols given by gnat or gnarl.

After some deeper search I got rid of the most symbols.

The problem occured during the bind step, which doesn't occure by gpr file 
usage. But this is only a guess.
It seems that the gnatbinder is using not only the system specific files for 
checking. So that the linker is forced to link all that files in my 
executable.
Then I played a little bit with the used switches.

This means I call gnatmake not with -I for system or dll dirs, instead I 
use -A switch in combination with -nostdlib.

Thanks everybody for your help and your hints.

If I have missed something or forgotten, please tell me.

Greetings

Alexander





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

end of thread, other threads:[~2007-11-29 10:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-22  9:18 Using Functions of Executable Alexander Camek
2007-11-22 10:18 ` Dirk Heinrichs
2007-11-26 11:15 ` Frank Piron
2007-11-26 13:07   ` Alexander Camek
2007-11-27  9:56     ` Frank Piron
2007-11-27 17:11       ` Pascal Obry
2007-11-28 10:57         ` Alexander Camek
2007-11-28 12:04         ` Martin Krischik
2007-11-28 13:12           ` Pascal Obry
2007-11-28  8:59     ` Stephen Leake
2007-11-27 13:08 ` Alexander Camek
2007-11-29 10:36 ` Alexander Camek

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