开发者

How to group some functions into a new memory section of .exe output in Visual C++

I need to use Visual C++ to build a customized Apache web server. Here is the goal I am开发者_开发技巧 trying to achieve: specify some of the functions or data in Apache source code, and put them in separate and 4k-page aligned sections (not .text .data .bss) of output .exe file.

The closet solution I can find online is use /Gy compiler options to compile each functions into different COMDATs, and then use /ORDER linker options to put the COMDATs in a predetermined order. However, it is just reordering inside a section, not changing the section layout in .exe output or creating a new section. Under Linux, I can use compiler attribute "section" and linker script to fulfill my goal. Are there equivalent solution in Visual C++? Thanks very much:-)


#pragma code_seg lets you specify the segment into which code will be placed. Along with being able to specify a name, the compiler keeps a stack of names so you can push and pop the current state if you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜