Skip to content

Fix AmiBroker plugin loading: Use Static MFC and disable ASLR/NX flags#6

Open
Pramodnm wants to merge 6 commits into
marketcalls:masterfrom
Pramodnm:fix/amibroker-mfc-static
Open

Fix AmiBroker plugin loading: Use Static MFC and disable ASLR/NX flags#6
Pramodnm wants to merge 6 commits into
marketcalls:masterfrom
Pramodnm:fix/amibroker-mfc-static

Conversation

@Pramodnm

@Pramodnm Pramodnm commented Jul 11, 2026

Copy link
Copy Markdown
  • Changed Win32 Release and Debug configurations from Dynamic MFC to Static MFC to eliminate external mfc140.dll dependency
  • Added /DYNAMICBASE:NO and /NXCOMPAT:NO linker flags to produce DLL with DllCharacteristics 0x0, matching working QP2.dll pattern
  • Resolves issue where AmiBroker 32-bit failed to load plugin with misleading '64-bit error' when mfc140.dll was missing
  • DLL now self-contained with only standard Windows system DLLs as imports
  • File size increased to ~2MB due to embedded MFC, but eliminates runtime dependency complications on end-user machines

Summary by cubic

Fixes AmiBroker 32-bit plugin loading by statically linking MFC and disabling ASLR/DEP on Win32. The DLL is self-contained, matches QP2.dll, and loads without mfc140.dll.

  • Bug Fixes

    • Link Win32 Debug/Release with Static MFC; removes external mfc140.dll.
    • Disable ASLR/DEP on Win32 (/DYNAMICBASE:NO, /NXCOMPAT:NO); DllCharacteristics now 0x0 to match QP2.dll, with the workaround documented in OpenAlgoPlugin.vcxproj to prevent regressions.
    • Clarify exports: added LIBRARY "OpenAlgo" in .def; reverted Plugin.cpp to upstream.
    • Clean up: remove unused headers (framework.h, pch.h), precompiled-header refs, and unused OPENALGO_EXPORTS define.
  • Migration

    • 32-bit build outputs OpenAlgo32.dll; update packaging and references if you used OpenAlgo.dll.
    • No MFC redistributable needed; ship only OpenAlgo32.dll.

Written for commit ddb9257. Summary will update on new commits.

Review in cubic

OpenAlgo Builder added 3 commits July 12, 2026 02:27
- Changed Win32 Release and Debug configurations from Dynamic MFC to Static MFC
  to eliminate external mfc140.dll dependency
- Added /DYNAMICBASE:NO and /NXCOMPAT:NO linker flags to produce DLL with
  DllCharacteristics 0x0, matching working QP2.dll pattern
- Resolves issue where AmiBroker 32-bit failed to load plugin with misleading
  '64-bit error' when mfc140.dll was missing
- DLL now self-contained with only standard Windows system DLLs as imports
- File size increased to ~2MB due to embedded MFC, but eliminates runtime
  dependency complications on end-user machines

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed against the latest diff

Not reviewed (too large): Plugin.cpp (~4,372 lines) - if these are generated or fixture files, add them to ignored paths to exclude them from future reviews.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread OpenAlgoPlugin.vcxproj
Comment thread framework.h Outdated
Comment thread pch.h Outdated
Comment thread OpenAlgoPlugin.vcxproj Outdated
OpenAlgo Builder added 3 commits July 12, 2026 02:37
…ymbols

- Remove framework.h: Never included by any source file
- Remove pch.h: Precompiled headers disabled (NotUsing) so unused
- Remove PrecompiledHeaderFile references: Only reference deleted pch.h
- Remove OPENALGO_EXPORTS: Preprocessor define never referenced in code

Keep RandomizedBaseAddress=false and DataExecutionPrevention=false in Win32 configs:
  These are necessary for AmiBroker 32-bit legacy loader compatibility. The
  host loader (AmiBroker.exe, 32-bit) requires DllCharacteristics=0x0 to load
  the plugin correctly. This is a documented host-loader workaround inherent
  to the AmiBroker plugin API design.
Adds inline documentation clarifying that RandomizedBaseAddress=false and
DataExecutionPrevention=false are necessary for AmiBroker 32-bit loader
compatibility (requires DllCharacteristics=0x0). Warns against re-enabling
without testing on target AmiBroker instance.

This directly addresses bot review concern by making the host-loader workaround
rationale immediately visible to future maintainers in the project file.
@Pramodnm

Copy link
Copy Markdown
Author

Fixes #1 - This PR implements the fix for the AmiBroker 32-bit plugin loading issue by using static MFC and disabling ASLR/NX flags.

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