From: "Shawn" Newsgroups: comp.os.msdos.djgpp References: <82jmt5$15u$1 AT tron DOT sci DOT fi> Subject: Re: NEEDING HELP TO START WINDOWS PROGRAMMING Date: Wed, 8 Dec 1999 01:00:18 -0500 Lines: 85 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: crbt-170.res.umass.edu Message-ID: <384df434@oit.umass.edu> X-Trace: 8 Dec 1999 01:01:24 -0500, crbt-170.res.umass.edu Organization: University of Massachusetts, Amherst To: djgpp AT Delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > "stefan fröberg" wrote: >Hello to everyone ! > >Few days back I decided to start learning Windows programming. >I found that I needed package called RSXNTDJ (really awfull name... :=)) before I could start to make any code. > >However, for me the stuff in this package raised more questions than answered. > >So, if I don't want to use the RSXNTDJ then what are the minimum steps required for writing code that calls the >WIN32 API and GUI? You make calls to the Win32 API, not it's GUI. >Do I have to modify (aarghh!) the GCC source code so that the compiler could understand the >DLLs or is there a way to change the GDI32.DLL, KERNEL32.DLL, etc.. to the library format that the GCC >understands ? Nope. The gcc.exe that comes with DJGPP compiles programs that for all intents and purposes don't even know that Windows is running. The .exe file format is different for Windows than for DOS, and DJGPP outputs DOS format .exe files. You need a c compiler (such as RSXNTDJ) that is capeable of creating Windows .exe files. All .dll files are pre-compiled code, and are in the .dll file format. You cannot convert these libraries into any other format. FYI, the compiler doesn't understand .dll format. You link to a .dll file either at the link stage through a stub library that calls the .dll, or dynamically in your program. Either way, the compiler has no understanding of the .dll file format. >Are these the steps needed for making working program that uses the WIN32 API and GUI ? > >My code (.c or .cc) + header files(.h) + libraries (.dll or .a ?) + definitions(.def ?)??? + resources(.rc ?)??? = >compelete program (.exe) Actually you only need a subset of these depending on what you are programming. The only real requirement for a Windows program is a .c file with a WinMain() function. Any Windows program that does much will have most, if not all of the files you mentioned above. >Also what are the .DEF and .RC files ? A .def file allows you to export your functions and assign them ordinal numbers. This is how you "see" functions inside a .dll library, the author has exported them in his .def file when he compiled the libraray. .Def files also serve as a point where you can name your application, assign a stub program that will be attached to your finished program and run if someone tries to run the .exe in DOS without Windows, assign attributes to the code and data, as well as specify heap and stack size. A .rc file contains the resources that your program will use. This includes icons, strings, dialogs, pictures, etc. If you are just learning Windows programming, you are probably better off looking for a tool to help you create .rc files, because creating dialog definitions in .rc sytnax is not the most intuitive way to do things :) >The libraries that the DJGPP uses are static, right ? Yes. >Meaning that when you start multiple copies of the same program in windows. >you also make multiple copies of the same library functions and they stay in memory, right ? Every program that is linked to a static library will have a copy of the functions that it uses from that library in memory when it is loaded. This means that common functions like printf() will most likely be in memory several times if many programs are run, but an obscure function may be only used by one program, and thus only one copy of its code will be in memory. >If there are plans to make a new version of the DJGPP package then I would suggest that the compiler should be >modified so that it can compile code that uses the WIN32 API & GUI and in the FAQ there should be an entry >that describes the basic steps needed to make Win programs. Hope that was some help. Good luck with your programming! -Shawn