The MASM Forum

Projects => MASM32 => Topic started by: jj2007 on December 11, 2015, 04:37:26 PM

Title: Polink bug?
Post by: jj2007 on December 11, 2015, 04:37:26 PM
I have a library module that has a buffer in the .DATA? section; the symbol is not exported, i.e. the buffer is known only to the module.

Now I discovered that the start address coincides with the start of another buffer in a different module.

This happens only with polink, both with the Masm32 version of 16.4.2011 and the latest polink of 21.3.15

Is this a known problem? Any workaround?
Title: Re: Polink bug?
Post by: hutch-- on December 11, 2015, 05:46:31 PM
This much, the module format without a stack frame is different to MASM.
Title: Re: Polink bug?
Post by: jj2007 on December 11, 2015, 06:20:59 PM
Your answer is somewhat cryptic, dear Hutch ::)

Anyway, I've found the culprit, polink is innocent, M$ linkers are half guilty because they allocate memory too generously, so the missing dword went unnoticed for quite a while :redface:
Title: Re: Polink bug?
Post by: hutch-- on December 11, 2015, 09:23:26 PM
This is a leftover from 2006. A no-stack frame procedure.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .model flat, stdcall    ; 32 bit memory model
    option casemap :none    ; case sensitive
    option cstrings:on      ; enable C string escapes

  ; *************
  ; include files
  ; *************
    include \poasm\include\windows.inc
    include \poasm\include\plib.inc
    include \poasm\include\gdi32.inc
    include \poasm\include\user32.inc
    include \poasm\include\kernel32.inc
    include \poasm\include\Comctl32.inc
    include \poasm\include\comdlg32.inc
    include \poasm\include\shell32.inc
    include \poasm\include\msvcrt.inc
    include \poasm\macros\macros.asm

    EXTERNDEF [your label name] :DWORD

    .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

align 16

[your label name]:

  ; your code here

    ret [balance stack here]

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    end