From: David F. on
Hi,

If I have a stoic library built that I want to link and say it's part of the
"PAGE" code segment how do I do that? The library could be used in either
case (non-paged or paged) when I know it's okay to use in PAGE segment I
want to tell the build to make it paged code to not allocate non-paged pool
space for the code.

Also how exactly does the code_seg with class information work? Can I
provide the segment and class name in the header file or in a .CPP module
and does that make that class always go to that segment even if that class
is compiled to its own static library too?

TIA!!


From: Maxim S. Shatskih on
> If I have a stoic library

"stoic"? really? or maybe neo-Platonic? :-)

I expect you mean "static".

> "PAGE" code segment how do I do that?

Try playing with scripts and options to LINK.

The default way is to use pragmas at compile time, which says the compiler to put the code to PAGE section in the .obj file.

But, if the library is already compiled without the pragmas, then its code is in .text default sections, and you will need some options to LINK to treat the library's .text as PAGE.

I don't know whether this is possible.

> Also how exactly does the code_seg with class information work?

Usual functions obey the same rules as with C, but the auto-generated C++ thunks like vtable/vbase stuff, "scalar deleting destructor" etc _do not obey any such rules_ and are just plain undocumented in this aspect. Same is true on template and "inline" expansions.

This is one of the most major issues with C++ in Windows kernel.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

From: David F. on
I was thinking about the linker option ... I'll see if I can find anything?

"Maxim S. Shatskih" <maxim(a)storagecraft.com.no.spam> wrote in message
news:uXrrCU6gKHA.1236(a)TK2MSFTNGP04.phx.gbl...
> If I have a stoic library

"stoic"? really? or maybe neo-Platonic? :-)

I expect you mean "static".

> "PAGE" code segment how do I do that?

Try playing with scripts and options to LINK.

The default way is to use pragmas at compile time, which says the compiler
to put the code to PAGE section in the .obj file.

But, if the library is already compiled without the pragmas, then its code
is in .text default sections, and you will need some options to LINK to
treat the library's .text as PAGE.

I don't know whether this is possible.

> Also how exactly does the code_seg with class information work?

Usual functions obey the same rules as with C, but the auto-generated C++
thunks like vtable/vbase stuff, "scalar deleting destructor" etc _do not
obey any such rules_ and are just plain undocumented in this aspect. Same is
true on template and "inline" expansions.

This is one of the most major issues with C++ in Windows kernel.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com


From: Alexander Grigoriev on
Using paged code is not worth trouble. Unless the code is over 20MB. Save
yourself from grief and forget about using PAGE sections.

"David F." <df2705(a)community.nospam> wrote in message
news:059BB54E-A6FB-477C-A525-368ACAECA83C(a)microsoft.com...
> Hi,
>
> If I have a stoic library built that I want to link and say it's part of
> the "PAGE" code segment how do I do that? The library could be used in
> either case (non-paged or paged) when I know it's okay to use in PAGE
> segment I want to tell the build to make it paged code to not allocate
> non-paged pool space for the code.
>
> Also how exactly does the code_seg with class information work? Can I
> provide the segment and class name in the header file or in a .CPP module
> and does that make that class always go to that segment even if that class
> is compiled to its own static library too?
>
> TIA!!
>
>


From: Don Burn on
I have to disagree. The 20MB figure is big even for todays systems, and if
your driver can potentially be used in an embedded system or similar limited
then forgetting PAGE sections is a bad idea. I know of a major vendor who
lost a number of lucrative contracts thanks to this approach. In one case
a client of mine acquired the sources, and by simple work on using PAGE
sections produced an overall improvment in their embedded system by well
over 50%.


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr


"Alexander Grigoriev" <alegr(a)earthlink.net> wrote in message
news:%23A2k4NLhKHA.2184(a)TK2MSFTNGP04.phx.gbl...
> Using paged code is not worth trouble. Unless the code is over 20MB. Save
> yourself from grief and forget about using PAGE sections.
>
> "David F." <df2705(a)community.nospam> wrote in message
> news:059BB54E-A6FB-477C-A525-368ACAECA83C(a)microsoft.com...
>> Hi,
>>
>> If I have a stoic library built that I want to link and say it's part of
>> the "PAGE" code segment how do I do that? The library could be used in
>> either case (non-paged or paged) when I know it's okay to use in PAGE
>> segment I want to tell the build to make it paged code to not allocate
>> non-paged pool space for the code.
>>
>> Also how exactly does the code_seg with class information work? Can I
>> provide the segment and class name in the header file or in a .CPP module
>> and does that make that class always go to that segment even if that
>> class is compiled to its own static library too?
>>
>> TIA!!
>>
>>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4715 (20091224) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4715 (20091224) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com