983 Subj : Re: Compiling C code with Borland C++ To : borland.public.cpp.borlandcpp From : Nathaniel L. Walker Date : Thu Dec 30 2004 06:41 am Check the email I replied to you. Watch which newsgroups you post in. Nathaniel L. Walker "Keith Woodard" wrote in message news:41d2d76c@newsgroups.borland.com... > Good Day, > > Thanks for your comprehensive answer. Here is my problem. I need to > compile a DLL using C code. Below is one example taken from a whitepaper > that I am using. Under Borland 5.5, what switches and syntax would you use > to compile and link my C file? I have three .s files that reference the > functions in startstunnel.c. > > Compile: cl /c startstunnel.c > Link: link startstunnel.obj /dll /export:startstunnel /export:killprocess > > P.S. I am from Louisiana. > > > Best Regards, > Keith Woodard > > > "Nathaniel L. Walker" wrote in message > news:41b88815$1@newsgroups.borland.com... > > > > Bob Gonder wrote: > > >Keith Woodard wrote: > > > > > >> Is there a way to use Borland C++ to compile C level code? > > > > > >Since C++ is C (plus more), obviously, yes, you can. > > > > > >Why? > > >Which compiler version are you using? > > >And what seems to be the problem? > > >Be as explicit as you can. > > >Others will be able to help you when they know the particulars. > > > > > > > > > > Why can't you just give him a straigtforward answer? > > > > Yes you can compile just C code. The easiest way to do so is to name your > source code files with a ".c" extension, and the compiler will compile it in > C mode. In fact, now that I checked, that looks like the only way to do it, > since most C++ code is backward compatible with C (most, not all) and the C > standard libraries are part of the C++ language (correct me if I'm wrong). > If you want to form a file with a different extension to be compiled as C++ > just use the "-P" command-line parameter (not that you'd want to). > > > > All in all, naming your source code files with a ".c" extension will tell > the compiler to compile it in C mode. This works from the IDE and from the > command-line. > > > > It's been that way since at least Borland/Turbo C++ 3.0, so your compiler > version means next to nothing :) > > > > Ciao and happy coding! > > > > Nathaniel L. Walker > > . 0