News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to undefine symbol in masm

Started by assembler, February 24, 2017, 10:28:56 AM

Previous topic - Next topic

assembler

If some file that I include contains:


foo PROC
local string[5]:byte
mov string[0], 'b'
mov string[1], 'l'
mov string[2], 'a'
mov string[3], 'h'
mov string[4], 0
invoke printf, addr string
ret
foo ENDP


And I want in the code segment of my program to define:


foo PROC
invoke printf, offset string_foo
ret
foo ENDP


Then there is the error symbol redefinition: foo

But in mainCRTStartup PROC, I want to write this line:
call foo

So the text "foo" will appear in the output of my console program.

Of course that there is solution to this problem and the solution is to undefine symbol "foo", that was included, before I define my foo. I don't want to name my foo procedure as MyFoo PROC, but foo PROC.
I don't know how to undefine symbol in masm and I want to know how to do this. I have already tried the PURGE command, but it is used for macros only, but not for symbols.

Any ideas?

hutch--

It doesn't work like that. What you place in either the INITIALISED or UNINITIALISED data sections stays there. A LOCAL variable lives for the length of time that the procedure it is written in runs but note that in either a GLOBAL variable (in the data section) or a LOCAL variable can be re-assigned to another value of the same data type.

Initialised string data.

.data
  mystring db "This is my string",0


Uninitialised data.

.data?
  myvariable dd ?


It sounds like from your questions that you need to learn some more basics of how an assembler program or module is laid out as this will make what you are doing a lot easier.

Just remember, no smartarse widsecracks, people here will help you but will not be messed around.

assembler

Quote from: hutch-- on February 24, 2017, 10:42:36 AM
It doesn't work like that. What you place in either the INITIALISED or UNINITIALISED data sections stays there. A LOCAL variable lives for the length of time that the procedure it is written in runs but note that in either a GLOBAL variable (in the data section) or a LOCAL variable can be re-assigned to another value of the same data type.

Initialised string data.

.data
  mystring db "This is my string",0


Uninitialised data.

.data?
  myvariable dd ?


It sounds like from your questions that you need to learn some more basics of how an assembler program or module is laid out as this will make what you are doing a lot easier.

Just remember, no smartarse widsecracks, people here will help you but will not be messed around.

This doesn't answer my question at all, and I already know these basics. I know that I didn't write the data segment and I know that I didn't write the include and includelib for printf, and the reason that I didn't write these is because I don't think it matters. What you should teach is how to undefine the included and existing symbol "foo", so I can define my own "foo". There is nothing wrong with my code.

hutch--

 :P

> What you should teach is how to undefine the included and existing symbol "foo", so I can define my own "foo"

If in doubt, learn what RTFM means. You seem to be under some delusion that you can wish your way through learning assembler. Now all I can recommend is that you hold your breath, then write an email to Microsoft telling them that they should have foreseen your desire to perform actions that their assembler does not perform.

> and I already know these basics

If this were true, you would not be asking silly questions.

assembler

Quote from: hutch-- on February 24, 2017, 11:18:46 AM
:P

> What you should teach is how to undefine the included and existing symbol "foo", so I can define my own "foo"

If in doubt, learn what RTFM means. You seem to be under some delusion that you can wish your way through learning assembler. Now all I can recommend is that you hold your breath, then write an email to Microsoft telling them that they should have foreseen your desire to perform actions that their assembler does not perform.

> and I already know these basics

If this were true, you would not be asking silly questions.
silly questions? What silly questions did I ask already? I only asked one question and it's not silly.

hutch--

I have tried to give you enough room to stop saying silly things and acting like an arrogant bastard but don't stretch the friendship, our members including myself are not paid employees or a commercial help desk. Keep making a pest of yourself and to protect our members from your bad manners, you will get shown the door.

If you are going to suffer from self inflicted "Foot in mouth" disease, at least tread in something horrible first.  :P

assembler

Quote from: hutch-- on February 24, 2017, 11:27:42 AM
I have tried to give you enough room to stop saying silly things and acting like an arrogant bastard but don't stretch the friendship, our members including myself are not paid employees or a commercial help desk. Keep making a pest of yourself and to protect our members from your bad manners, you will get shown the door.

If you are going to suffer from self inflicted "Foot in mouth" disease, at least tread in something horrible first.  :P

I think that I am going to close this discussion here right now. Thanks for the help anyway.

HSE

Assembler:

     The answer still is "It doesn't work like that"     

     You think "foo" is a symbol, but not, is an address. And every address is unique. (indeed is an offset, no matter).

     And yes, you need to learn assembler, and pay more attention.

       
Equations in Assembly: SmplMath

jj2007

Quote from: assembler on February 24, 2017, 10:53:55 AMWhat you should teach is how to undefine the included and existing symbol "foo", so I can define my own "foo". There is nothing wrong with my code.

A propos RTFM: Which manual are you reading? A good one would have told you already that writing an email to Micros**t is the only way to obtain that kind of symbol redefinition :icon_mrgreen:


LordAdef

and the said thing is that you really still didn't understand what they said and why it doesn't work as you wanted to.

assembler

Quote from: LordAdef on February 24, 2017, 09:21:33 PM
and the said thing is that you really still didn't understand what they said and why it doesn't work as you wanted to.
Why?

hutch--

Much of the problem is we have not got a clue what you are trying to do and you have kept feeding us bullsh*t when asked. Your assumption that you can un-define a symbol is simply wrong and it does not depend on either your imagination or your desire. Assembler is in fact a very precise form of processor control (programming) and it does not depend on guess work or aspiration, it depends purely on knowing how it works.

Given that many of the folks here have been writing assembler code successfully for over 20 years, in my case over 25 years and some of our members have even longer experience, feeding any of us bullsh*t only gets a hostile response, especially as it looks like a fishing expedition for something hidden like virus or trojan coding, many of which we have seen over a long period.

Now cut the bullsh*t and tell us what you are trying to do. If its illegal you will get kicked out so be warned. Also, spare us the lip or you will get booted out.

LordAdef

Quote from: assembler on February 25, 2017, 12:15:05 AM
Quote from: LordAdef on February 24, 2017, 09:21:33 PM
and the said thing is that you really still didn't understand what they said and why it doesn't work as you wanted to.
Why?

Open a debugger and find out what foo is.

K_F

assembler:

With assembler programming you have to do your homework first - and there's a lot of it - don't be put off  :dazzled:.
I'd suggest reading though the forum topics and picking out the most important bits that would help you.

For any experienced programmer, not even assembly, your questions show that you actually do not know what assembly programming is all about.
The forum assumes you're a total newbie and actually require a lot of reading on your part.
Or you're spamming, there's a lot of these that come through here, hence the very terse response.

If you're thick skinned like most of us.. we'll see more of you
;)
But remember a lot of people here are well versed with hacking and virus methods, so it's not advisable to ask questions related to such topics, no matter how you try disguise it.  :eusa_naughty: (Read the Forum Rules)
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'