🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #38354

Re: C++ and callbacks

#38354
From: Glenn M. Poorman
Date: Tue, 03 May 1994 19:08
23 lines
2208 bytes
In article <2q65gv$oln@bigblue.oit.unc.edu>, brandon@uncvx2.oit.unc.edu (Brandon Van Every) writes:
|> Paul Durbin (pauld@verdix.com) wrote:
|> : I attempt to use a member function as callback but all three arguments (to the
|> : callback) are garbage. If I make it a friend then the arguments are correct,
|> : but then I can't get to the class data, without reference thru an instance of
|> : the class and I don't want the data to be static.
|> 
|> : So, what is causing this problem? 
|> 
|> Motif is based on C, not C++.  You have to use "extern C" linkage for any of
|> your callbacks.  You can't register any C++ function directly.  You have to
|> write a plain C front end for anything you want to have callbacked.

Actually the function does not have to have "extern C" linkage.  It just
can't be a non-static member function.

-- 
=========================================================================
Glenn M. Poorman             Ford Motor Company
Rm 2228, Bldg #3             Phone: (313) 33-73316
20000 Rotunda Dr.            Fax  : (313) 39-08817
Dearborn, MI. 48121          Email: poorman@cadcam.pms.ford.com
=========================================================================
Technical Details
Message-ID: <2q67fpINNgv5@eccdb1.pms.ford.com>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!rtp.vnet.net!mary.iia.org!babbage.ece.uc.edu!news.kei.com!yeshua.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!jobone!slee01.srl.ford.com!eccdb1.pms.ford.com!cc4032.pms.ford.com!poorman
References: <pauld.767898877@sarge> <2q65gv$oln@bigblue.oit.unc.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,ad5a39011a2d3d26
X-Google-Attributes: gid109fba,public
X-Google-Thread: 103734,ad5a39011a2d3d26
X-Google-Attributes: gid103734,public
X-Google-Thread: 10ba33,ad5a39011a2d3d26
X-Google-Attributes: gid10ba33,public
X-Google-ArrivalTime: 1994-05-03 14:17:58 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!rtp.vnet.net!mary.iia.org!babbage.ece.uc.edu!news.kei.com!yeshua.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!jobone!slee01.srl.ford.com!eccdb1.pms.ford.com!cc4032.pms.ford.com!poorman
From: poorman@cc4032.pms.ford.com (Glenn M. Poorman)
Newsgroups: comp.windows.x,comp.lang.c++,gnu.g++.help
Subject: Re: C++ and callbacks
Date: 3 May 1994 19:08:41 GMT
Organization: ECC at Ford Motor Company, Dearborn Michigan
Lines: 23
Distribution: world
Message-ID: <2q67fpINNgv5@eccdb1.pms.ford.com>
References: <pauld.767898877@sarge> <2q65gv$oln@bigblue.oit.unc.edu>
NNTP-Posting-Host: cc4032.pms.ford.com