GoAsm declares defaulty all invoked functions as externals. Based on the GoAsm approach, the apicall macro eliminates the use of include files and import libraries but there is no parameter checking.

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include apicall.inc

WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data
ClassName    db "WndClass",0
Application  db "Simple Window",0

.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
.code
start:
apicall GetModuleHandleA, NULL
mov    hInstance,eax
apicall GetCommandLineA
mov    CommandLine,eax
apicall WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
apicall ExitProcess,eax
.
.


apicall MACRO name:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15

local pos,counter
counter=0

    FOR arg,<p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
        IFNB <arg>

            counter=counter+1
            pos=@InStr(1,arg,<ADDR>) OR @InStr(1,arg,<addr>) OR @InStr(1,arg,<Addr>)

            IF pos

                IF (OPATTR(@SubStr(arg,%pos+5))) EQ 98
                    lea eax,@SubStr(<arg>,%pos+5)
                    push eax
                ELSE
                    push OFFSET @SubStr(<arg>,%pos+5)
                ENDIF

             ELSE
             
             push arg
             
             ENDIF
        ENDIF
    ENDM

API_function TEXTEQU @CatStr(name,<@>,%4*counter)
EXTERNDEF API_function:proc
call API_function

ENDM


\masm32\bin\ml /c /coff SimpleWnd.asm
\goasm\golink SimpleWnd.obj kernel32.dll user32.dll


Notice that it's possible to link the object file with Polink or MS link.
Attachments:
Posted on 2005-10-16 05:05:27 by Vortex
Time a go I have played with Golink for do the assembly of my nasm files (basic ones, included some of the iczelions), you should note that GoLink let to his assembler pass a flag or something about where a section is shared, the tutorial about Hooks was not able to run OK (even that is linked OK), because I dont find any flag in the Linker, the only way that I can think of is a hex editor and reverse the section???



Geremy know about this issue, tought dont know if new version of GoLink support this now???
Posted on 2005-10-16 10:25:27 by rea
Geremy know about this issue, tought dont know if new version of GoLink support this now???


Hi rea!
Yes we corresponded about this before.

So you want to be able to use a linker switch to make a section shared because (unlike GoAsm) the assembler you are using does not permit you to specify this in the source script?

I have not actually added this feature to GoLink, but I have done something else which ought to provide you with a solution.  Previously if GoLink found two sections of the same name, one which had the shared attribute (characteristics flag 10000000h) and one which did not, it would make two separate sections.  This was on the assumption that the user intended this.  However the GoAsm help file has advised for some time that shared sections ought to have a unique name eg. "ShData" or something like that.  And there does not seem to be any harm in combining same-name shared and non-shared sections.  So the version of GoLink attached below (version 26.4 beta) will now combine such sections (ie. it will combine two sections of the same name after all, even if their shared flags are different).

So you can now:-

1. Make a small source file and declare a section using this syntax:-
    DATA SECTION "ShData" SHARED
2. Add a little data to make sure that the object file is made.
3. Assemble using GoAsm.
4. In your source code which you are going to assemble using the other assembler, ensure that the section which you want to be shared has the same name as the one in the GoAsm file.
5. Link all object files together with GoLink.

You should then find that your intended shared section does indeed have the shared attribute.

This version of GoLink is a beta version because it is a 32/64-bit version of GoLink.  This works fine however, I haven't had any bug reports.

See my web site for full details and free downloads of the "Go" tools and 64-bit developments.
Attachments:
Posted on 2005-10-22 04:24:28 by jorgon