Linking libraries into drivers... How to ensure NON-Pageable? #pragma code_seg() ?

Hi all,

Who actually takes care of the #pragma code_seg(), and #pragma code_seg(“PAGE”) instruction. Is
this the compiler, the linker, or both? What is the default if none is specified? (Non Pageable?)

Let’s say I want to make a simple library of routines, and link it with my Driver. Let’s say I
compile this library using the latest Visual Studio .NET compiler (Not the DDK). What will the
.NET compiler do to statements like #pragma code_seg()? Will it “TAG” these functions as
“Non-Pageable” and then the DDK Linker will realize this, and make sure it is also non-pageable when
finally linked into the driver?

What about constant declared tables?

Example, what if I have this little function in my library, that does a “Look up” on a static const


#pragma code_seg()

const int lookUpTable={1,2,3,4,5};

int libraryFunction(void)
return (lookUpTable[0]);

I compile this into a library called “Library.lib” using Visual Studio .NET. I link this library
into my driver, and in my driver I call this function. Will the DDK linker realize I tagged this
with #pragma code_seg() when I built the library, and put these routines *AND* the table in
nonpageable space? Or is it anybody’s guess what kind of memory pool this will be allocated from?

I guess the big quesiton: Is there any way to guarantee that a table & function that is imported
from a Library into a driver is in Non-Pageable space, similar to how we can do this with #pragma
code_seg() in Driver code?

==================== 08/30/2004 09:58:22 PM MailFilter-1 ====================
This email may contain confidential and privileged material for the sole use of the intended recipient. Any unauthorized review, use or distribution by others is strictly prohibited. If you have received the message in error, please advise the sender by reply email and delete the message. Thank you.