On Tue, May 27, 2008 at 12:58 PM, John Matthews <[EMAIL PROTECTED]> wrote: > --- In [email protected], Benjamin Scott > <[EMAIL PROTECTED]> wrote: >> >> If you want a user to be able >> to start a program, You need >> int Main(), or Winmain. Sorry. > > Sorry to keep going on about this, but technically you don't if you > write a Linux device driver with your program in (or called from) the > driver's initialisation function and load it (eg. using insmod). > > No, it's not ideal, especially if you are running Windows :-) or your > program does things that easily implemented in a (kernel) device > driver like most forms of user interaction, and you need super-user > privileges to use insmod. But it is still an answer to the OP's > question, and the OP didn't place any conditions on the answer.
Linux device drivers aren't anything special in terms of being loadable modules -- they are just dynamically linked libraries that extend the capabilities of the main executable (in this case, the Linux kernel). Device drivers on Windows aren't different in principle. However, it must be pointed out that while Linux device drivers don't have main(), they still have a defined entry point that gets called when the module is loaded by the kernel. And whether the entry point is main() or some other defined entry point, it still serves the same purpose. As I pointed out earlier, you can even change the entry point for an executable with some compilers. Visual C++'s Linker has the /ENTRY option, for instance, to specify the starting adress for an .exe or DLL. -- Brett ------------------------------------------------------------ "In the rhythm of music a secret is hidden; If I were to divulge it, it would overturn the world." -- Jelaleddin Rumi
