MASM 中的长代码长度错误?
我目前正在开发一个相当大的装配程序,它是一个聊天机器人。 目前它包含 700 多行代码。在我的程序中,我有两个标签,我的程序使用这些标签来跟踪以随机方式移动的某些数据。
让我向你解释一下发生了什么。程序要做的工作很大,所以我倾向于将这些代码切成碎片。我为我的程序所需的所有功能创建单独的项目,当它们工作时,我将它们包含在主程序中。
我刚刚完成了其中一项功能,并将其集成到我的程序中。该功能位于我之前告诉过您的两个标签之间。
当我尝试编译该程序时,出现错误:
ChatterBot.asm<22>:无法识别的符号:EEEndLenght(这是第二个标签的名称)
该标签在第 655 行上距第 633 行更远,如果我再次删除该函数,错误就会消失,我确信相同的标签在新函数中没有出现,我已经多次更改了它的名称
有谁知道为什么会发生这种情况以及如何修复它?
概述:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\masm32rt.inc
include \masm32\include\masm32.inc
include \masm32\include\wsock32.inc
includelib \masm32\lib\wsock32.lib
system PROTO C, :PTR BYTE
SavePoly PROTO
.code
Start:
...
...
mov ecx, (EEEdnLength - Startl) ; line 22, with the label
...
...
Startl
...
...
GetNumb1And8 PROTO
Filleax PROTO
...
...
FSTR PROTO
recv PROTO
GetData PROTO, nread:DWORD
...
main proc
...
...
Rand proc
...
Rand endp
...
...
main endp
...
...
FSTR proc
...
...
FSTR endp
...
...
GetData proc nread:DWORD
...
...
GetData endp
...
...
end main
...
...
EEEdnLength:
...
...
ret
SavePoly endp
EndForError:
edd:
ret ; kthxbai
end Start
编辑:现在我这样看,我想我已经找到了问题所在,结束主 - 这是错误的。我很抱歉浪费了你们的时间,确实是 :end main 搞砸了。
I'm currently working on a rather big assembly program it's a chatter bot.
It spans currently well over 700 lines of code. In my program I've two labels, my program uses these labels to keep track of certain data that gets moved around in a random manner.
Let me explain to you what happened. The job the program has to do is big, so what I tend to do is I chop these bits of code in pieces. I create separate projects for all the functions my program needs, and when they're working I include them in the main program.
I had one of these functions completed just now, and I integrated it into my program. The function came between the two labels I told you about before.
When I tried to compile the program I got an error saying:
ChatterBot.asm<22>: Unidentified symbol: EEEndLenght (which is the name of the 2nd label)
The label is 633 lines further away on line 655, if I remove the function again, the error disappears, I'm sure the same label doesn't occur in the new function and I've changed it's name several times
Does anyone know why this is happening and how I can fix it?
Overview:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\masm32rt.inc
include \masm32\include\masm32.inc
include \masm32\include\wsock32.inc
includelib \masm32\lib\wsock32.lib
system PROTO C, :PTR BYTE
SavePoly PROTO
.code
Start:
...
...
mov ecx, (EEEdnLength - Startl) ; line 22, with the label
...
...
Startl
...
...
GetNumb1And8 PROTO
Filleax PROTO
...
...
FSTR PROTO
recv PROTO
GetData PROTO, nread:DWORD
...
main proc
...
...
Rand proc
...
Rand endp
...
...
main endp
...
...
FSTR proc
...
...
FSTR endp
...
...
GetData proc nread:DWORD
...
...
GetData endp
...
...
end main
...
...
EEEdnLength:
...
...
ret
SavePoly endp
EndForError:
edd:
ret ; kthxbai
end Start
Edit: now I look at it like this, I think I've already found what's wrong, end main - that's wrong. I'm sorry for wasting your time guys, it was indeed the :end main that messed up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使没有代码中的摘录,真的很难猜测,但一种可能性是,如果您使用
.mode" 语句,MASM 将默认仅导出
proc 的名称s -- 定义如下的“正常”标签:
mylabel:` 仅在该源文件内可见。如果这是问题,您可以添加
export EEEdnLength
,或者(如果)内存服务)你可以这样定义它:EEEndLength::
(两个冒号而不是一个)。It's really hard to guess without even an extract from your code, but one possibility is that if you use a
.mode" statement, MASM will default to exporting only names of
procs -- a "normal" label defined like:
mylabel:` is visible only inside that source file.If that's the problem, you can add
export EEEdnLength
, or (if memory serves) you can define it like:EEEndLength::
(two colons instead of one).