this was codeblocks wrapper code to create a new link.exe regarding the win32dll. but im having problems with this

VB Code:
  1. Option Explicit
  2.  
  3. Private Const LINK_FILE = "LINKER.EXE"
  4.  
  5. Dim FSO As FileSystemObject
  6.  
  7. Private Sub cmdCancel_Click()
  8.  
  9. Open App.Path & "\LinkerLog.txt" For Append As #1
  10.  
  11.     Print #1, Now & ": ============================================"
  12.     Print #1, Now & ": Command Line Options:   "; Command$
  13.     Print #1, Now & ": ============================================"
  14.     Print #1, vbCrLf & vbCrLf
  15.    
  16. Close #1
  17.  
  18. ShellWait App.Path & "\" & LINK_FILE & ".exe " & Command$
  19.     Unload Me
  20. End Sub
  21.  
  22. Private Sub CmdOk_Click()
  23.  
  24.     Dim CmdLine As String
  25.     CmdLine = Command$
  26.    
  27.     CmdLine = Replace(CmdLine, "/ENTRY:__vbaS", "/ENTRY:DLLMain") ' BookMark #1
  28.     CmdLine = Replace(CmdLine, "/BASE:0x400000", "/BASE:0x10000000")
  29.     CmdLine = CmdLine & " /DLL /DEF:" & """" & txtCompiler.Text & """"
  30.  
  31.     If Len(Dir(txtCompiler.Text, vbNormal)) <= 0 Then
  32.         MsgBox "No such DEF file.. please verify again!"
  33.         Exit Sub
  34.     End If
  35.  
  36.     LINK CmdLine
  37.    
  38. End Sub
  39.  
  40. Private Sub Form_Load()
  41.    
  42.     Dim intPos As Integer
  43.     Dim strPath As String
  44.    
  45.     Dim fld As Folder
  46.     Dim fil As File
  47.    
  48.     Set FSO = New FileSystemObject
  49.      
  50.      
  51.         ' Determine if .DEF file exists
  52.     '
  53.     ' Extract path from first .obj argument
  54.     intPos = InStr(1, Command$, ".OBJ", vbTextCompare)
  55.     strPath = Mid$(Command$, 2, intPos + 2)
  56.     intPos = InStrRev(strPath, "\")
  57.     strPath = Trim$(Left$(strPath, intPos - 1))
  58.     strPath = Replace$(strPath, """", "")
  59.    
  60.     Debug.Print strPath
  61.    
  62.     ' MsgBox "Path=" & strPath
  63.    
  64.     ' Open folder
  65.     Set fld = FSO.GetFolder(strPath)
  66.    
  67.     ' MsgBox fld.Path
  68.    
  69.     ' Get files in folder
  70.     For Each fil In fld.Files
  71.         ' MsgBox fil
  72.         If UCase$(FSO.GetExtensionName(fil)) = "DEF" Then
  73.            txtCompiler.Text = fil
  74.            Exit For
  75.         End If
  76.     Next
  77.    
  78.     If txtCompiler.Text = vbNullString Then
  79.         LINK  ' Default
  80.     Else
  81.         If MsgBox("Click Yes to apply DLL options over a Standard EXE Project," & vbCrLf & "otherwise click No to let VB handle the usual way.", vbYesNo) = vbNo Then
  82.             LINK  ' Default
  83.         End If
  84.     End If
  85. End Sub
  86.  
  87. Sub LINK(Optional CmdLine As String = vbNullString)
  88.  
  89. If CmdLine = vbNullString Then CmdLine = Command$
  90. If CmdLine = vbNullString Then
  91.     Unload Me
  92.     Exit Sub
  93. End If
  94.  
  95.     Open App.Path & "\LinkerLog.txt" For Append As #1
  96.  
  97.     Print #1, Now & ": ============================================"
  98.     Print #1, Now & ": Command Line Options:   "; Command$
  99.     If CmdLine <> Command$ Then
  100.     Print #1, Now & ": Command Line Options:   "; CmdLine ' Write only if there was a change
  101.     End If
  102.     Print #1, Now & ": ============================================"
  103.     Print #1, vbCrLf & vbCrLf
  104.    
  105.     Close #1
  106.    
  107.     ShellWait App.Path & "\" & LINK_FILE & " " & CmdLine ' i.e.: My SuperShell function
  108.     Unload Me
  109. End Sub

Do i put this code in a *form* (i noticed CmdOK and CmdCancel functions in the code..) or a *module*?
Do i add any references to the project?
I keep getting an error with the 'shellwait' lines saing its not defined or something

Please may someone help me with this. It's just the linker part which im having problems with, awaiting your replies, many thanks in advance!!