Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Win32Asm question

Win32Asm question

Win32Asm question

I'm currently trying to make head and tail of Win32Asm programming.  Anyway one thing I noticed is that the Window Class Registration structure is almost always created and loaded from the .code section.  Couldn't most of that data be initialized and placed in the .data section?  Some data (such as hInstance) will still be loaded from the code space but most of the data is constant in each instance anyway...

Just wondering.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Win32Asm question

Aparrently no one else here is doing Win32Asm... <sob>

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Win32Asm question

Yes it can & I do this all the time. If you're looking at the Iczelion tutes they're great but only take them as a starting point... your commonsense should guide thru the rest of the learning process.  There is an old saw that goes "Don't have code do the work of data & vice versa." It applies to assembler too. Having said all this tho, most of the window setup is execute once & then you're waiting for window$ to get done picking it's nose so this isn't the place to be looking for speed gains.

RE: Win32Asm question

The reason that a compiler might put that structure in the code section is to make it read-only. Most win32 linkers make the code (.text) section read-only.

Some compilers put C strings in the code section for that reason.

Also, in a DLL, the code section is shared by all processes (with some exceptions), and a separate data section is created for each seperate instance of the DLL. Putting that structure in the code section would reduce the size of your data section, potentially saving a few KB per instance.

Doug Gale

RE: Win32Asm question

It's being created DYNAMICALLY using a LOCAL directive.  Which doesn't make sense because it still ends up in the stack, a portion of the data section.  Might as well have placed it there in the first place.

Also, you need to load the instance variable into the structure, which means it can't be placed in a read-only section.  Each instance is different for each instance, too... hmm, that seems kind of vague...

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close