comp.lang.ada
 help / color / mirror / Atom feed
From: andrei.krivoshei@gmail.com
Subject: Directory Operations
Date: Mon, 3 Nov 2008 08:27:36 -0800 (PST)
Date: 2008-11-03T08:27:36-08:00	[thread overview]
Message-ID: <91990db2-68b4-4710-ba9b-b3a9d8375cad@e38g2000prn.googlegroups.com> (raw)

Hello.
I have a problem.
I need to write a DLL with a function, which returns the path to a
current directory under Windows XP.
I have't any problem with DLL itself, but when I try to use some
function from the package "GNAT.Directory_Operations" or
"Ada.Directories", I get the unexecutable DLL.
NOTE! The executable file is working, I talk only about DLL variant!

Thanks!

The code listing of my program is

========= Spec ============
with Interfaces.C.Strings; use Interfaces.C.Strings;

package FAD is

   procedure Pwd(Path_ptr: in out Chars_ptr );
   pragma Export(C, Pwd, "pwd");

end FAD;

========= Body ============
--  with Ada.Directories;
with Ada.Strings;
with GNAT.Directory_Operations;

package body FAD is
   package DOP renames GNAT.Directory_Operations;
   use Ada.Strings;

   procedure Pwd(Path_ptr: in out Chars_ptr ) is
--        use Ada.Directories;
      CStr: Chars_ptr;
      Path: String (1 .. 1024);
   begin
--      Path: String := "custom test string";  -- with this code line,
the DLL is executable
      Path := DOP.Get_Current_Dir;  -- with this code line, the DLL is
UNexecutable
      CStr := Null_Ptr; -- Value for test purposes only
      Path_ptr := CStr;
   end Pwd;

end FAD;



             reply	other threads:[~2008-11-03 16:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03 16:27 andrei.krivoshei [this message]
2008-11-03 17:33 ` Directory Operations Dmitry A. Kazakov
2008-11-04 12:57   ` AndreiK
2008-11-04 14:44     ` Dmitry A. Kazakov
2008-11-04 13:52 ` AndreiK
replies disabled

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