The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: slash128gnr on October 02, 2010, 04:13:35 PM

Title: Procedure Call Problem
Post by: slash128gnr on October 02, 2010, 04:13:35 PM
I'm trying to write my own procedure call but when I go to link the file it says fatal error "LNK1120: 1 unresolved externals". I am new to masm so any help would be greatly appreciated.

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\masm32.inc
include     \masm32\include\user32.inc
includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\masm32.lib
includelib    \masm32\lib\user32.lib

isPrime PROTO :dword

.data?
buffer db 100 dup(?)
.code
start:
invoke isPrime, 322

END start

isPrime proc arg1:dword
    mov eax, arg1
    mov ebx, 4
    mov ecx, 5
    mov edx, 6
    Ret
isPrime endp
Title: Re: Procedure Call Problem
Post by: redskull on October 02, 2010, 04:19:22 PM
Your procedure is after the END statment; move the procedure between the .code directive and the start: label. Also, you may want to perform some sort of ExitProcess() call or 'ret' to keep it from crashing.

-r
Title: Re: Procedure Call Problem
Post by: slash128gnr on October 02, 2010, 06:04:44 PM
Thanks that fixed it.