Purpose of _LINUX_EXPORT_H macro

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?



Link: _LINUX_EXPORT_H in torvalds/linux on github










share|improve this question

















  • 5





    Are you asking about the purpose of include guards?

    – steeldriver
    Mar 3 at 1:39






  • 1





    It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

    – JdeBP
    Mar 3 at 7:04















2















What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?



Link: _LINUX_EXPORT_H in torvalds/linux on github










share|improve this question

















  • 5





    Are you asking about the purpose of include guards?

    – steeldriver
    Mar 3 at 1:39






  • 1





    It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

    – JdeBP
    Mar 3 at 7:04













2












2








2








What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?



Link: _LINUX_EXPORT_H in torvalds/linux on github










share|improve this question














What is the purpose of defining _LINUX_EXPORT_H in include/linux/export.h? It seems to be defined in this file and never referenced anywhere else. Is it redundant?



Link: _LINUX_EXPORT_H in torvalds/linux on github







linux kernel c






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 3 at 1:26









MartinMartin

111




111







  • 5





    Are you asking about the purpose of include guards?

    – steeldriver
    Mar 3 at 1:39






  • 1





    It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

    – JdeBP
    Mar 3 at 7:04












  • 5





    Are you asking about the purpose of include guards?

    – steeldriver
    Mar 3 at 1:39






  • 1





    It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

    – JdeBP
    Mar 3 at 7:04







5




5





Are you asking about the purpose of include guards?

– steeldriver
Mar 3 at 1:39





Are you asking about the purpose of include guards?

– steeldriver
Mar 3 at 1:39




1




1





It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

– JdeBP
Mar 3 at 7:04





It appears that the questioner is asking for the purpose of that macro not knowing that it is an include guard.

– JdeBP
Mar 3 at 7:04










1 Answer
1






active

oldest

votes


















2














If you look carefully at the file, it starts and ends with these lines:



#ifndef _LINUX_EXPORT_H
#define _LINUX_EXPORT_H
...
#endif /* _LINUX_EXPORT_H */


These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.



These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h has



#ifndef _PWD_H
#define _PWD_H 1





share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504036%2fpurpose-of-linux-export-h-macro%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    If you look carefully at the file, it starts and ends with these lines:



    #ifndef _LINUX_EXPORT_H
    #define _LINUX_EXPORT_H
    ...
    #endif /* _LINUX_EXPORT_H */


    These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.



    These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h has



    #ifndef _PWD_H
    #define _PWD_H 1





    share|improve this answer





























      2














      If you look carefully at the file, it starts and ends with these lines:



      #ifndef _LINUX_EXPORT_H
      #define _LINUX_EXPORT_H
      ...
      #endif /* _LINUX_EXPORT_H */


      These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.



      These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h has



      #ifndef _PWD_H
      #define _PWD_H 1





      share|improve this answer



























        2












        2








        2







        If you look carefully at the file, it starts and ends with these lines:



        #ifndef _LINUX_EXPORT_H
        #define _LINUX_EXPORT_H
        ...
        #endif /* _LINUX_EXPORT_H */


        These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.



        These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h has



        #ifndef _PWD_H
        #define _PWD_H 1





        share|improve this answer















        If you look carefully at the file, it starts and ends with these lines:



        #ifndef _LINUX_EXPORT_H
        #define _LINUX_EXPORT_H
        ...
        #endif /* _LINUX_EXPORT_H */


        These lines mean that if the file is included twice (either through a mistake or through including another file that includes this file) then the second time around the value is defined, and so the whole file is effectively skipped.



        These are commonly known as "header guards" or "include guards" and you'll note that many of the standard include files use this pattern; e.g pwd.h has



        #ifndef _PWD_H
        #define _PWD_H 1






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 3 at 14:23









        Kusalananda

        138k17258428




        138k17258428










        answered Mar 3 at 14:21









        Stephen HarrisStephen Harris

        27.1k35283




        27.1k35283



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504036%2fpurpose-of-linux-export-h-macro%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay