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,a96494c0cf26ab81 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: generic procedure'address or pragma convention? Date: 1996/04/07 Message-ID: <4k74lg$ni9@news2.delphi.com>#1/1 X-Deja-AN: 146162359 organization: Delphi Internet Services Corporation newsgroups: comp.lang.ada Date: 1996-04-07T00:00:00+00:00 List-Id: >>Is it likely that a compiler will support OS callbacks to a procedure >>declared in a generic package body? If not, is there some reasonably >>portable trick to get the effect? > >Can you be a little more explicit in what you want to do? Clearly you >cannot call a procedure in a generic package body, only in an instance >of this body. What problem are you trying to solve here? I would like to create something similar to: generic with function a_WndProc(param_block:in parameters) return boolean is default_WndProc; package Window is .. package body Window is this_window:my_data_structure; .. procedure actual_WndProc(... -- parameters as per Windows or OS/2 pragma convention (or whatever's appropriate if using Ada 83) -- various stuff, including making param_block from OS parameters if a_WndProc(param_block) ... end actual_WndProc; .. procedure create_window(... ... -- OS call to create a window, including passing -- actual_WndProc'address for a callback The problem I'm trying to solve is to make an Ada version of Microsoft Foundation Classes editor_window.do_something(... style, rather than the normal Ada's do_something(editor_window,... by using generics. I tried something like this in Alsys Personal ActivAda and they complain about 'pragma call_in(actual_WndProc)' because it's not library level. I tried their 'enter_callback;' stuff and it crashed. The Ada 95 RM says pragma convention may be restricted to library units. I can certainly see that you can't straightforwardly generate link names for generic instantiations, but they aren't necessary here. And handling code-sharing generics could take some cleverness. That's why I asked if its 'likely' that a compiler would support this sort of thing.