News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

using masm32 lib

Started by Jimg, July 29, 2005, 03:33:21 PM

Previous topic - Next topic

zooba

I think regardless of how robust the macro was written it would still require the programmer to get the input right!

Jimg, I have used macros similar to that before for generating large redirect-DLLs and it works fine. Just ignore these guys trying to bloat your software  :cheekygreen:

ToutEnMasm

hello,

I try to modify the macro

LIBRAIRIE MACRO nomsansext:VARARG
         local inclus,librairie
   FOR nom,<nomsansext>
            inclus CATSTR  <include  \masm32\include\> ,<nom>,<.inc>
            librairie CATSTR  <includelib \masm32\lib\>,<nom>,<.lib>     
            % inclus
            % librairie   
   ENDM
ENDM

using it     LIBRAIRIE user32,kernel32,perso32,imagehlp,masm32

It's work , but the masm32 made an "internal error" with  MakeIP MACRO,put the macro in comments
and there is no more problem,       
                                    WHY ????????????????

                                       ToutEnMasm

           



PBrennick

#17
 :U

This is the version of uselib that I like and will use from now on.  It has been tested.


    uselib MACRO namelist:VARARG
    FOR item, <namelist>
      include \masm32\include\item.inc
      includelib \masm32\lib\item.lib
      ENDM
    ENDM

    uselib kernel32,user32,comctl32,wsock32,comdlg32


It is similar to ToutEnMasm's version but uses the easy to understand methods employed by Jimg.

ToutEnMasm,
I just noticed the macro problem, also.  Evidently the assembler cannot handle that.

Hutch,
Would you consider moving that macro to macro.asm?  I am going to do it on my machine for sure.

EDIT:  Actually, I just noticed it already exists in dlglib.inc, so I just deleted the macro from masm32.inc

Paul
The GeneSys Project is available from:
The Repository or My crappy website

ToutEnMasm

Hello,
I agree it is more simple , but there is the same bug

\masm32\include\masm32.inc(172) : fatal error A1016: Internal Assembler Error

with the masm32.inc,makeip isn't allowed.I try it with ml 6.15 an 7.10.


               ToutEnMasm


PBrennick

Hutch is going to move that macro to macro.asm in the next version so no more problem  :U

Paul
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

Something I am missing here, there are two seperate macros involved and I don't know what the relationship is. Paul identified a duplicate I had with the pre-built dialog code so I have removed it so there is only one copy which is still in te masm32.inc file at the moment. Then there are the various versions of macros that load both the include file and the library in one macro call. What i don't know is how the two are related.

Can someone fill me in on what is happening here ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

PBrennick

Hutch,
There is an odd error that is generated when a macro loads an include file that loads a macro.  The error message is VERY vague and says that there is an internal assembler error.  If the macro that is in masm32.inc is remmed out the error disappears.  I don't think this has anything to do with your project but appears to be some sort of limittation of the preprocessor.

This is the error that is generated...

Quote
Assembling: ZipDLL.asm
\masm32\include\masm32.inc(180) : fatal error A1016: Internal Assembler Error

This is the macro I am using...

    include \masm32\include\windows.inc

    uselib MACRO namelist:VARARG
    FOR item, <namelist>
      include \masm32\include\item.inc
      includelib \masm32\lib\item.lib
      ENDM
    ENDM

    uselib kernel32,user32,masm32,comctl32,wsock32,comdlg32


Now, my macro is a compile time macro but MakeIP is a runtime macro.  That is the only difference that I can think of.  This means my macro is 'used' by the assembler whereas MakeIP is not but perhaps the assembler 'thinks' that it is in the firat pass and improperly expands it?  I am just guessing so I will await your answer.  You are the preprocessing guru, not me!

If you need a test piece I can provide one.  If I remove the MakeIP macro or rem it out, the error disappears.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

Paul,

Its a problem with a transformation in the macro FOR loop. I put the macro directly into macros.asm and removed the IP macro and it fails on other macro calls. I will see if I can get it working but the included backdslash characters are clashing with masm line continuation characters.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ToutEnMasm

Hello,
After some more testing,macros are not allowed in the files loaded by FOR .... LOOP.
BackSlash is allowed in the line

      include macro.inc
      include \masm32\include\windows.inc
       LIB kernel32,gdi32,user32,Comctl32,masm32,comdlg32,shell32,oleaut32,\
ole32,msvcrt,imagehlp,perso32

                     ToutEnMasm


PBrennick

Hutch,
Toutenmasm makes sense here.  As far as the backslash is concerned, it is not the problem at all and never was.  The problem still occurred when I tried putting the paths into the environment and removing them from the macro so it was as follows...


    include \masm32\include\windows.inc

    uselib MACRO namelist:VARARG
    FOR item, <namelist>
      include item.inc
      includelib item.lib
      ENDM
    ENDM

    uselib kernel32,user32,masm32,comctl32,wsock32,comdlg32


Thank you for the help, though, and I have no doubt you will figure it out.  When it comes to macros, I am out of my depth.  I just write them and expect the ornery things to cooperate.  ::)

I will have to read up on FOR loops.  Does anyone know of a good document for macros (advanced, perhaps)?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

Paul,

This appears to work fine.


      include \masm32\include\windows.inc
      include \masm32\macros\macros.asm

  ; -----------------------------------------------

    uselib MACRO args:VARARG
      LOCAL acnt,buffer,var,lbl,libb,incc,buf1,buf2
      acnt = argcount(args)
      incc equ <include \masm32\include\>
      libb equ <includelib \masm32\lib\>
      var = 1
    :lbl
      buffer equ getarg(var,args)

      buf1 equ <>
      buf1 CATSTR buf1,incc,buffer,<.inc>
      buf1
      % echo buf1

      buf2 equ <>
      buf2 CATSTR buf2,libb,buffer,<.lib>
      buf2
      % echo buf2

      var = var + 1
      IF var LE acnt
        goto lbl
      ENDIF
    ENDM
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

PBrennick

Hutch
I cannot get that to work.  It produces the following errors...

Quote
Assembling: ZipDLL.asm
ZipDLL.asm(41) : error A2008: syntax error : ,
uselib(2): Macro Called From
  ZipDLL.asm(41): Main Line Code
ZipDLL.asm(41) : fatal error A1000: cannot open file : \masm32\include\getarg(??001B,kernel32,user32,masm32,comctl32,wsock32,comdlg32).inc
uselib(41): Macro Called From
  ZipDLL.asm(41): Main Line Code

It evidently does not like the commas in the following line...

    uselib kernel32,user32,masm32,comctl32,wsock32,comdlg32

So I removed the commas and was left with this...

Quote
Assembling: ZipDLL.asm
ZipDLL.asm(41) : fatal error A1000: cannot open file : \masm32\include\getarg(??001B,kernel32 user32 masm32 comctl32 wsock32 comdlg32).inc
uselib(41): Macro Called From
  ZipDLL.asm(41): Main Line Code


Any thoughts?
Paul
The GeneSys Project is available from:
The Repository or My crappy website

hutch--

Paul,

Give tis a blast, its the next macros.asm file. Make sure you include BOTH Windows.inc and the macro file before you call the macro.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

PBrennick

#28
Hutch,
That works VERY well.  Thank you very much.  The following is the start of my code...



    .386
    .model  flat,stdcall
    option  casemap:none

    include \masm32\include\windows.inc
    include \masm32\macros\macros.asm
    uselib  kernel32,user32,comctl32,wsock32,comdlg32



I will now take some time to dissect your macro so that I will fully understand how it works.  I like the simplicity of its utilization.  It is a nice compliment to the masm32rt.inc which handles a wide range of applications.  This is a nice way of handling any that drop through the cracks for whatever reasons.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

MazeGen

Maybe I miss something, but what actually causes the Internal Assembler Error, guys?

When I remove the MakeIP macro from masm32.inc, it works well. Too bad, I can't see what is wrong with MakeIP  :(