sstars 发表于 2005-9-23 10:40:19

关于SQABasic函数调用的问题

以下的代码运行时总是出错:"Runtime error '903' -(省略), External procedure not found"。错误发生在调用ReadDirectory directory, array()时,用单步跟踪连ReadDirectory函数体都进不去,请大家帮我分析一下怎么回事。
    路径名应该没有问题,因为把ReadDirectory函数和Main函数放在一起的话,程序是没有问题的,但放在不同的文件里就出问题了。

main.rec:
'$Include "ReadDirectory.sbh"

Sub Main
    Dim Result As Integer

    Dim array(100) as String
    Dim directory
   
    directory = "C:\Documents and Settings\Administrator\Desktop\test\"
   
    'there is an error here, why
    ReadDirectory directory, array()
   
End Sub


directory.sbh:
Declare Sub ReadDirectory BasicLib "ReadDirectory"(destDir as String, array() as String)


directory.sbl:
Sub ReadDirectory(destDir as String, array() as String)

Dim item as String
Dim count as Integer
Dim msgtext as String

count = 1
MsgBox destDir
Chdir destDir
   
'Get each item in the directory
item = Dir(destDir,16)
Do While item<>""
    Msgbox item
    array(count) = item
    item = Dir
    if item <> "" then
      count = count + 1
    end if
Loop

End Sub

DontTest 发表于 2005-9-27 09:48:24

要细心点!

'$Include "ReadDirectory.sbh"

ReadDirectory.sbh=directory.sbh ???????????

DontTest 发表于 2005-9-27 09:49:34

Declare Sub ReadDirectory BasicLib "ReadDirectory"(destDir as String, array() as String)

显然也是错的,原因同上

sstars 发表于 2005-9-28 05:52:28

汗!再检查一下看看!
页: [1]
查看完整版本: 关于SQABasic函数调用的问题