Skip to content

Use image base __ImageBase directly for module handle#12

Open
RatinCN wants to merge 1 commit into
PlummersSoftwareLLC:mainfrom
RatinCN:imagebase-optimization
Open

Use image base __ImageBase directly for module handle#12
RatinCN wants to merge 1 commit into
PlummersSoftwareLLC:mainfrom
RatinCN:imagebase-optimization

Conversation

@RatinCN

@RatinCN RatinCN commented Jun 17, 2026

Copy link
Copy Markdown

Replace GetModuleHandleA and the stored hInst value with the linker-provided __ImageBase symbol.

Measured with the local build:

  • trpad.obj drops from 14911 to 14852 bytes (-59)
  • the Crinkler output drops from 2794 to 2783 bytes (-11)

Also reduced 7 lines code.

Replace GetModuleHandleA and the stored hInst value with the linker-provided __ImageBase symbol. This removes the import, the local hInstance slot, and the global hInst storage while still passing the module base to RegisterClass/CreateWindowEx and the Go To dialog.

Measured with the local build: trpad.obj drops from 14911 to 14852 bytes (-59), and the Crinkler output drops from 2794 to 2783 bytes (-11).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant