Reputation: 21
I have a full Ada project I want to build to get a dynamic dll. Therefore I have to link it with another static library (myanotherlibrary.lib).
I use this command line :
gprbuild -d "D:\My_grp_project\My_grp_project.gpr"
Here the content of the .gpr :
project My_grp_project is
Architecture := "x86";
for Languages use ("Ada");
for Source_Dirs use (".", "source", "source\common");
for Library_Dir use "dll\" & Architecture;
for Library_Ali_Dir use "ali\" & Architecture;
for Library_Name use "My_grp_project";
for Library_Kind use "dynamic";
for Object_Dir use "obj\" & Architecture;
package Linker is
for Default_Switches ("Ada") use ("-L.", "-lbar");
end Linker;
end My_grp_project;
I put "myanotherlibrary.lib" in the directory "D:\My_grp_project\", but it still doesn't link: "undefined reference to ..."
Could anyone help me please ?
Regards Glen
Upvotes: 1
Views: 2896
Reputation: 21
Here the solution I finally found.
project My_grp_project is for Languages use ("Ada"); for Source_Dirs use (".", "source", "source\common"); for Library_Dir use “dll"; for Library_Ali_Dir use "ali"; for Object_Dir use "obj"; for Library_Name use "My_grp_project"; for Library_Kind use "dynamic"; for Library_Options use ("path\myanotherlibrary.a", "path_to_GNAT\libstdc++.a"); end My_grp_project;
Voilà. Thanks !
Upvotes: 1
Reputation: 25511
Looking at the docs, I think you should be using the Library_Options
attribute instead of package Linker
:
for Library_Options use ("-L.", "-lbar”);
(I’m confused - do you mean myanotherlibrary.lib
or bar.lib
?)
I’d be a bit concerned about using a static library from a dynamic library: I’d expect the dynamic library to be built with -fPIC
or equivalent switch to get position-independent code, so that the same loaded library binary can be seen at different addresses in each of the executables using it.
Upvotes: 3