comp.lang.ada
 help / color / mirror / Atom feed
From: Stefan Bellon <sbellon@sbellon.de>
Subject: Re: Undefined reference to glib_E
Date: Mon, 26 Mar 2007 15:57:02 +0200
Date: 2007-03-26T15:57:02+02:00	[thread overview]
Message-ID: <20070326155702.6c20c0b4@cube.tz.axivion.com> (raw)
In-Reply-To: newscache$gfjifj$j2p$1@pleione.3soft.de

Alexander Camek wrote:

> Okay, after some searching i found in the executable i build before
> the symbol :(.

Sorry, I do not understand what you mean.

> So it seems i have to use an import library, because it seems that
> the build will not work like under unix.
> I first build under unix my "executable" and then use many shared
> objects.

If you build DLLs, then those DLLs need to see all symbols they refer
to. If they depend on other DLLs, that's usually no problem ...

> Do I need in that case the previous named "import library", because
> windows is doing the whole a little bit diffrent?

... but when your DLL indeed depends on the main executable, then you
need an import library. We have such a case as well. In the Linker
section of the main executable we have:

   package Linker is
      case Common.Target_OS is
         when "linux-gnu" =>
            for Default_Switches ("ada") use
              Common.Linker'Default_Switches ("ada") &
              "-Wl,--export-dynamic";
         when "solaris2.8" | "solaris2.9" | "solaris2.10" =>
            for Default_Switches ("ada") use
              Common.Linker'Default_Switches ("ada");
         when "mingw32" | "cygwin" =>
            for Default_Switches ("ada") use
              Common.Linker'Default_Switches ("ada") &
              "-Wl,--export-all-symbols,--out-implib,main.lib";
      end case;
   end Linker;

On GNU/Linux you need the --export-dynamic if you need to get at the
symbols of the main executable from plugins you load via dlopen. On
Solaris this is default. On Windows, you can see the commands that
generate the import library.

Then, in the library that depends on the symbols of the main
executable, we have the following in the project file:

   case Common.OS is
      when "UNIX" =>
         null;
      when "Windows_NT" =>
         for Library_Options
           use GtkAda.Linker'Linker_Options &
             (Common.Global_Obj & "main.lib");
   end case;

The Common.Global_Obj is the object directory of your main project as
the import library has been placed there.

I hope this helps.

Greetings,
Stefan

-- 
Stefan Bellon



  reply	other threads:[~2007-03-26 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 10:35 Undefined reference to glib_E Alexander Camek
2007-03-26 13:14 ` Stefan Bellon
2007-03-26 13:43   ` Alexander Camek
2007-03-26 13:57     ` Stefan Bellon [this message]
2007-03-26 14:45       ` Alexander Camek
replies disabled

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