How to refer to the start-of a user-defined segment in a Visual Studio-project?

后端 未结 2 1659
轮回少年
轮回少年 2021-01-02 15:30

I\'m struggling to convert a C-program linked with ld, of the gnu tool-chain to make it compile as a visual-studio (2005) project. The program puts .data-symbols in differe

2条回答
  •  生来不讨喜
    2021-01-02 15:56

    Create additional segments (they are placed in memory alphabetically):

    #pragma data_seg("MY_DATA_FOO__a")
    #pragma data_seg("MY_DATA_FOO__z")
    #pragma data_seg("MY_DATA_FOO__m")
    
    __declspec(allocate("MY_DATA_FOO__a")) int fooFirst;
    __declspec(allocate("MY_DATA_FOO__z")) int fooLast;
    __declspec(allocate("MY_DATA_FOO__m")) int foo1;
    __declspec(allocate("MY_DATA_FOO__m")) int foo2;
    

    Then copy everything between &fooFirst and &fooLast.

提交回复
热议问题