Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!sjsca4!poffen From: poffen@sj.ate.slb.com (Russ Poffenberger) Newsgroups: comp.windows.ms.programmer Subject: Re: Solution to BC++ Petzold problem, and mild bug report Message-ID: <1991May13.232028.17319@sj.ate.slb.com> Date: 13 May 91 23:20:28 GMT References: <2828D392.40DD@wilbur.coyote.trw.com> <1991May9.160511@geohub.gcn.uoknor.edu> Reply-To: poffen@SunOS (Russ Poffenberger) Organization: Schlumberger Technologies, ATE division, San Jose, Ca. Lines: 39 In article <1991May9.160511@geohub.gcn.uoknor.edu> butch@geopix.gcn.uoknor.edu writes: >In article <2828D392.40DD@wilbur.coyote.trw.com>, rich@wiley.uucp (Rich >Messenger) writes: > >|>I recently posted a question about wierd behavior trying to get >|>Petzold's first sample program from _Programming Windows_ to run under >|>BC++. Although there were no reposnses from this news group, I >|>eventually tracked down the problem and thought I might be of general >|>interest to other BC++ users. >|> >|>(1) When you are compiling as C++, you *cannot* use the EXPORTS section >|>in the .DEF file, since the name is mangled by C++ before the linker >|>ever sees it. This tidbit is not mentioned in the documentation. >|> >|>(2) You can use "smart callbacks" and thigs work great as long as >|>you're not writing a DLL or using the huge memory model. >|> >|>(3) You can tag exportable functions with "_export". You *must* put >|>this keyword in both the function declaration and function definition. >|>MILD BUG: BC++ does not complain if you declare the function without >|>_export, and define it with _export; it simply exhibits wierd behavior >|>on execution. >|> > >Would someone please explain this to me. I recently copied the SysMets >program from the book and it worked just fine. I didn't use the _export >tag but simply used the EXPORTS section of the DEF. It seemed to work >fine. Was it really messed up but I just didn't notice? >Response by e-mail is fine. > What was the name of the file? sysmets.c? or sysmets.cpp? If the file has a ".c" extension, then it is compiled as straight "C" code, and the name mangling problem doesn't appear. Russ Poffenberger DOMAIN: poffen@sj.ate.slb.com Schlumberger Technologies UUCP: {uunet,decwrl,amdahl}!sjsca4!poffen 1601 Technology Drive CIS: 72401,276 San Jose, Ca. 95110 (408)437-5254