Article View: comp.windows.x
Article #38359Re: C++ and callbacks
From: Brandon Van Every
Date: Thu, 05 May 1994 05:11
Date: Thu, 05 May 1994 05:11
28 lines
2455 bytes
2455 bytes
Glenn M. Poorman (poorman@cc4032.pms.ford.com) wrote: : 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. I can't find anything in Stroustrup that says this will work. The default linkage for all functions is "C++" (p. 524). Given that, I'd say that not using "extern C" is rather risky. Cheers, Brandon -- Brandon Van Every "No more LaunchPAD .Sigs! HA HA HA HA HA HA!!!" brandon@uncvx2.oit.unc.edu
Technical Details
Message-ID:
<2q9v55$ted@bigblue.oit.unc.edu>Path:
arc1-ca.pugleaf.net!gmd.de!nntp.gmd.de!urmel.informatik.rwth-aachen.de!newsserver.rrzn.uni-hannover.de!ina.zfn.uni-bremen.de!marvin.pc-labor.uni-bremen.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.duke.edu!concert!bigblue.oit.unc.edu!uncvx2!brandonReferences:
<pauld.767898877@sarge> <2q65gv$oln@bigblue.oit.unc.edu> <2q67fpINNgv5@eccdb1.pms.ford.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103734,ad5a39011a2d3d26 X-Google-Attributes: gid103734,public X-Google-Thread: 109fba,ad5a39011a2d3d26 X-Google-Attributes: gid109fba,public X-Google-Thread: 10ba33,ad5a39011a2d3d26 X-Google-Attributes: gid10ba33,public X-Google-ArrivalTime: 1994-05-05 00:25:41 PST Path: arc1-ca.pugleaf.net!gmd.de!nntp.gmd.de!urmel.informatik.rwth-aachen.de!newsserver.rrzn.uni-hannover.de!ina.zfn.uni-bremen.de!marvin.pc-labor.uni-bremen.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news.duke.edu!concert!bigblue.oit.unc.edu!uncvx2!brandon From: brandon@uncvx2.oit.unc.edu (Brandon Van Every) Newsgroups: comp.windows.x,comp.lang.c++,gnu.g++.help Subject: Re: C++ and callbacks Followup-To: comp.windows.x,comp.lang.c++,gnu.g++.help Date: 5 May 1994 05:11:01 GMT Organization: The University of North Carolina at Chapel Hill Lines: 28 Distribution: world Message-ID: <2q9v55$ted@bigblue.oit.unc.edu> References: <pauld.767898877@sarge> <2q65gv$oln@bigblue.oit.unc.edu> <2q67fpINNgv5@eccdb1.pms.ford.com> NNTP-Posting-Host: uncvx2.oit.unc.edu X-Newsreader: TIN [version 1.2 PL2]