Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!ditka!comeau From: comeau@ditka.Chicago.COM (Greg Comeau) Newsgroups: comp.sys.amiga.programmer Subject: C++ access of AmigaDOS C routines Message-ID: <39590@ditka.Chicago.COM> Date: 23 May 91 16:35:07 GMT References: <1474@loki.une.oz.au> <38576@ditka.Chicago.COM> <72373@microsoft.UUCP> Sender: comeau@ditka.Chicago.COM (Greg Comeau) Reply-To: comeau@csanta.attmail.com (Greg Comeau) Organization: Comeau Computing Lines: 40 In article <72373@microsoft.UUCP> davidbro@microsoft.UUCP (Dave BROWN) writes: >In article <38576@ditka.Chicago.COM> comeau@csanta.attmail.com (Greg Comeau) writes: >>I'm not versed enough in AmigaDOS specific, however what I can tell you >>is that compiler supporting either the 2.0 or 2.1 spec of C++ have >>something called 'extern "C"' syntax which allows you an interface to >>C. Under some, for instance, Comeau C++, we literally pick up your C >>compilers include files. Hence, the call in C++ would be *EXACTLY* the >>same as it would be in C. > >Just to pick nits, this is true unless the AmigaDOS or Intuition function >name is the same name as a method in a current class definition, in which case >the name would be prepended with :: . I was not referring to doing anything special with the functions like putting then into a class. I was just mentioning that the current facilities of accessing C routines, be it printf or any other(s), is not a problem. In any event, to make it clear to the net what Dave is referring to, it is something like this: class someclass { /* ... */ int printf(const char *, ...); /* ... */ void someotherfunc() { printf("Hello, world\n"); // This calls someclass's printf ::printf("Hello, world\n"); // This calls the C file scoped printf // The :: is not required outside of someclass's ``member functions'' // since there would only be on printf outside the class and if // someclass's printf was needed it would be used via normal class // instance syntax: someclass asomeclass; asomeclass.printf(); } }; -- Greg -- Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418 Producers of Comeau C++ 2.1 Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421 Voice:718-945-0009 / Fax:718-441-2310