Search code examples
clinuxwindowswinapiclib

Windows programmer moving to linux - Coding conventions


I have been developing for Windows for a long time, mainly WinApi (and .Net).

I'v started learning basic Linux, and I have some questions regarding the differences:

  1. In Windows I have barely used the C Standard library.

    If I needed an API, I would search MSDN and find the appropriate library\function.

    From what it seems like, in Linux the C Standard library is EVERYTHING.

    All the code samples I have seen used the standard library (Instead of using some Linux internal functions, like a Linux "CreateFile").

    Is this really how writing "proper" linux code is done ? Using the C standard library ?

    If I wish to read a file, or allocate memory are fopen\malloc the way to go ?

  2. If the answer to my first question is yes (And I guess it will be)

    The C standard library is POWERLESS compared to the powerful WinApi.

    Lets say I wish to get a list of running process (CreateToolhelp32Snapshot) or create a thread or a process (CreateThread\CreateProcess), How should I do that in Linux ?

  3. Documentation.

    In Windows, all I need can be found in MSDN.

    If I have a "how do I do" question (Like the questions above) where should I go ?

    Where is my main source of documentation.

Thanks a lot, Michael.


Solution

  • Perhaps you've forgotten that the Standard C Library isn't environment-specific, it specifies least-common-denominator functionality among all systems that can run C programs, and C runs on systems that don't even have processes.

    If you want an API that provides consistent common GUI/multithread/etc. APIs, pick a likely-looking GUI/multithread/etc. API. You might start with Qt, it's quite comprehensive and produces good-looking, near-native UIs on a host of systems.

    It's not generally considered polite to point this out, but most questions that get asked publicly are asked by people who lack the discipline to do even simple research. Once people can do that, they don't need to ask very many, and that's why what you see is so ... trivial. You're past that. For more options, you could start here.

    For more general-purpose tools, the top hit on a search for important linux tools might be helpful.