none
adding empty section as first section RRS feed

  • Question

  • Hi,

    I'm using visual studio 2012 to compile c++ application. I need to add section for data storage
    I know there is something like #pragma code_seg(".my_data1") and #pragma bss_seg(".my_data1") and that would do the job but the problem is section .my_data1 must be the first segment/section in my application (in section table) 
    How can I instruct linker to do that ? thanks in advance!
    Thursday, November 7, 2013 1:31 PM

Answers

  • Hi,

    According to your description, init_seg may be helpful for you.  Init_seg specifies a keyword or code section that affects the order in which startup code is executed.

    #pragma init_seg({ compiler | lib | user | "section-name" [, func-name]} )

    More detailed information, please refer to link below.

    http://msdn.microsoft.com/en-us/library/7977wcck(v=vs.110).aspx

    Best Regards,

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 11, 2013 9:16 AM
  • It does not seem that the #pragma init_seg does what the OP wants, but the documentation on section naming & sorting can be helpful.

    -- pa

    Monday, November 11, 2013 1:44 PM

All replies

  • See what happens if you name your section ".aaa". I seem to remember sections are arranged alphabetically.

    Igor Tandetnik

    Thursday, November 7, 2013 8:14 PM
  • thanks for your anwser unfortunately that did not help I tried #pragma code_seg(".aaa") and it's second section

    also I tried data_seg(".aaa") then its fourth section.

    • Edited by McCorcle Thursday, November 7, 2013 9:13 PM
    Thursday, November 7, 2013 9:10 PM
  • Hi,

    According to your description, init_seg may be helpful for you.  Init_seg specifies a keyword or code section that affects the order in which startup code is executed.

    #pragma init_seg({ compiler | lib | user | "section-name" [, func-name]} )

    More detailed information, please refer to link below.

    http://msdn.microsoft.com/en-us/library/7977wcck(v=vs.110).aspx

    Best Regards,

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 11, 2013 9:16 AM