From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8877 invoked by alias); 5 Jun 2002 10:36:29 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 8810 invoked from network); 5 Jun 2002 10:36:24 -0000 Received: from unknown (HELO mailout09.sul.t-online.com) (194.25.134.84) by sources.redhat.com with SMTP; 5 Jun 2002 10:36:24 -0000 Received: from fwd06.sul.t-online.de by mailout09.sul.t-online.com with smtp id 17FY9M-0005bu-02; Wed, 05 Jun 2002 12:36:20 +0200 Received: from webmail.t-online.de (06733961024-0001@[172.18.16.207]) by fwd06.bbul.t-online.de with smtp id 17FY9H-0CZqhUC; Wed, 5 Jun 2002 12:36:15 +0200 To: gcc-help@gcc.gnu.org Subject: dynamic vtables in c-program's on ia64 From: W.Stuehlmeyer@t-online.de Date: Wed, 05 Jun 2002 03:36:00 -0000 Message-ID: <1023273350.3cfde98608434@webmail.t-online.de> X-Priority: 3 (Normal) X-Complaints-To: abuse#webmail@t-online.com X-Sender: 06733961024-0001@t-dialin.net X-SW-Source: 2002-06/txt/msg00024.txt.bz2 Hello, i have dynamically created c-programs with vtable structures. Example: typedef struct IMallocVtbl { HRESULT ( *QueryInterface) (IMalloc * pThis, const IID & riid, void ** ppvObject); ULONG ( *AddRef) (IMalloc * pThis); ULONG ( *Release) (IMalloc * pThis); void * ( *Alloc) (IMalloc * pThis, ULONG cb); ... } IMallocVtbl; typedef struct CMalloc { IMallocVtbl *lpVtbl; } CMalloc; IMallocVtbl * g_lpVtblMalloc = 0; CMalloc g_CMalloc; IMalloc * g_pMalloc = (IMalloc *) &g_CMalloc; IMallocVtbl CRetailMallocVtbl = { CMalloc_QueryInterface, CMalloc_AddRef, CMalloc_Release, CRetailMalloc_Alloc, ... }; HRESULT MallocInitialize(BOOL fForceLocalAlloc) { ... g_lpVtblMalloc = &CRetailMallocVtbl; g_CMalloc.lpVtbl = g_lpVtblMalloc; return hr; } extern "C" LPVOID CoTaskMemAlloc(ULONG ulcb) { if (g_CMalloc.lpVtbl == 0) { MallocInitialize(0); } // // SEGMENTATION VIOLATION // return g_pMalloc->Alloc(ulcb); } I create a function address pointer in CRetailMallocVtbl. With gcc 3.0.x it works fine, but gcc 3.1 has a new ABI and g_pMalloc->Alloc(ulcb) needs a pair on a itanium machine. I have no idea how could create a GP adress pointer or a function address/GP address pair from a C. I found no information on www.codesourcecery.org how could i create these address pairs. How can i solve this problem? Only IMallocVtbl could be modified ( typedef struct IMallocVtbl ... and IMallocVtbl CRetailMallocVtbl = ..) via macros in a header file.