Dear Dmitry,
We produce DLLs written using GNAT that are used by other languages - typically C++
We don't explicitly run any initialisation code, the main procedure is always empty.
(although this is probably a left over from our ObjectAda days)
If something has to be initialised then we put this into a procedure, export it and request that our C++ user calls this before calling any other routine.
Here is a typical Gpr file for one of our Dlls.
-------
project Monitor is
package Naming is
for Casing use "mixedcase";
end Naming;
for Library_Name use "Monitor";
for Shared_Library_Prefix use "";
for Source_Dirs use ("W:\Source\Ada\Interfaces\Monitor",
"W:\Source\Ada\Interfaces",
"W:\Source\Ada\Shared",
"W:\Source\Ada\Open\Shared",
"W:\Source\Ada\Open\Shared\Windows");
for Library_Interface use ("Monitor_Interface");
for Object_Dir use "objects";
for Library_Options use ("-LW:\Product\Windows", "resources.o");
for Library_Dir use "W:\Product\Windows";
for Library_Ali_Dir use "D:\Binary\Ada\Interfaces\Monitor";
for Library_Kind use "dynamic";
for Library_Standalone use "encapsulated";
package Pretty_Printer is
for Default_Switches ("ada") use ("-i2", "-M120", "-aL", "-A1", "-A4");
end Pretty_Printer;
package Builder is
for Default_Switches ("ada") use ("-s", "-g");
end Builder;
package Compiler is
for Default_Switches ("ada") use
("-O1", "-gnatQ", "-gnata", "-gnato", "-g", "-gnat12",
"-gnatwcehijkmopruvz.c.n.p.t.w.x", "-gnatykmpM120");
end Compiler;
package Binder is
for Default_Switches ("ada") use ("-E");
end Binder;
end Monitor;
-------
and the main package.
-------
with Monitor_Interface; --> UD: Drag in Code
procedure Monitor is
begin
null;
end Monitor;
-------
Monitor_Interface ads exports all the procedures that the DLL provides and the Adb implements them.
Hoping this helps,
MfG
Ahlan