comp.lang.ada
 help / color / mirror / Atom feed
From: michael@ifr16.luftfahrt.uni-stuttgart.de (Michael Paus)
Subject: Re: Address to function pointer conversion
Date: 1997/06/16
Date: 1997-06-16T00:00:00+00:00	[thread overview]
Message-ID: <5o39sm$2fl6@info4.rus.uni-stuttgart.de> (raw)
In-Reply-To: dewar.866305487@merv


The problem which I have mentioned in my original post arises when you
want to interface an Ada program to a C function which can return pointers
to different functions like, e.g. dlsym on some UNIX systems or 
GetProcAddress
on Windows NT. These functions are essential when you want to open a
shared library (or DLL) dynamically at runtime of your program and access
functions contained in this library. Depending on the given argument (a 
string
with the name of the function) you get a void pointer to this function which 
you
just cast to the appropriate pointer type in C. So, how would you do that in
Ada? System.Address_To_Access_Conversions does not work as I have
pointed out already in my first post. An unchecked conversion may also be
problematic and is not portable. The only portable solution I see at the 
moment is
to import the dlsym function several times for each anticipated function 
pointer
type. This is not a very nice solution but I think it should work.

Any comments are welcome.

Michael





  reply	other threads:[~1997-06-16  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-13  0:00 Address to function pointer conversion Michael Paus
1997-06-13  0:00 ` Samuel Mize
1997-06-14  0:00   ` Robert Dewar
1997-06-13  0:00 ` John G. Volan
1997-06-14  0:00   ` Robert Dewar
1997-06-17  0:00     ` John G. Volan
1997-06-20  0:00       ` Robert Dewar
1997-06-24  0:00         ` Matthew Heaney
1997-06-24  0:00           ` Robert Dewar
1997-06-25  0:00             ` Michael Paus
1997-06-14  0:00 ` Robert A Duff
1997-06-14  0:00 ` Robert Dewar
1997-06-16  0:00   ` Michael Paus [this message]
1997-06-16  0:00     ` Robert A Duff
1997-06-16  0:00     ` Robert Dewar
1997-06-16  0:00       ` Samuel Mize
1997-06-16  0:00         ` Robert A Duff
1997-06-17  0:00         ` Robert Dewar
1997-06-17  0:00           ` Samuel Mize
1997-06-20  0:00             ` Robert Dewar
1997-06-20  0:00             ` Robert Dewar
replies disabled

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