From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bbbeae4ed07e9626 X-Google-Attributes: gid103376,public From: michael@ifr16.luftfahrt.uni-stuttgart.de (Michael Paus) Subject: Re: Address to function pointer conversion Date: 1997/06/16 Message-ID: <5o39sm$2fl6@info4.rus.uni-stuttgart.de>#1/1 X-Deja-AN: 248806461 References: <5nrq5h$13cm@info4.rus.uni-stuttgart.de> Organization: Comp.Center (RUS), U of Stuttgart, FRG Newsgroups: comp.lang.ada Date: 1997-06-16T00:00:00+00:00 List-Id: 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