Announcement

Collapse
No announcement yet.

Run-time error: File not found. foo.dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tom Hanlin
    replied
    Registering a DLL will create information about it in the registry, if it's
    the sort of DLL that requires registration and the registration succeeds.

    I have no idea what the Excel Lister does.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • John Weinland
    Guest replied
    Originally posted by Tom Hanlin:
    DLLs created by PowerBASIC do not require (or benefit from) registration, which is why you didn't see any change to the registry.

    11/4/2000
    Tom,
    Thanks. Normally, then, registration of a DLL does create a Registry
    entry? Does the Excel Lister then simply list all DLLs?
    PowerBASIC DLLs work fine for me now. Am also building some
    DLLs with VB (which contain an entry point) for comparison.
    Programming is a part-time effort for me to create workplace
    timesavers, not major software and, thanks to PB, is fun again!
    Regards,
    John


    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    DLLs created by PowerBASIC do not require (or benefit from) registration, which is why you didn't see any change to the registry.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • John Weinland
    Guest replied
    10/14/2000
    Thanks for the responses. My DLL does work now and the following may help others:

    1) Use the function or sub ordinal number AS the ALIAS in both the Vb Declare and the PB Function. It seems this number can be any number at all and need not be sequential. Type the ordinal number preceded with a pound-sign all in double-quotes as the ALIAS. Remember that PB capitalizes function-names automatically.

    VB5:
    Public Declare Function RND2LONG Lib "OILCALC.DLL" Alias "#3" (ByVal x As
    Long) As Long
    Public Declare Function RND2INTEGER Lib "OILCALC.DLL" Alias "#2" (ByVal x As
    Single) As Single
    Public Declare Function RND2DECIMALS Lib "OILCALC.DLL" Alias "#1" (ByVal x
    As Single) As Single

    PB:
    FUNCTION RND2LONG ALIAS "#3"(BYVAL x AS LONG) EXPORT AS LONG
    FUNCTION RND2DECIMALS ALIAS "#1"(BYVAL x AS SINGLE) EXPORT AS SINGLE
    FUNCTION RND2INTEGER ALIAS "#2"(BYVAL x AS SINGLE) EXPORT AS SINGLE

    2) Register the DLL with RegSvr32. This may or may not be necessary, but does not hurt. No one has yet clarified for me just where DLLs are registered. A search through my Registry (Win95) did not show anything. Excel has a DLL lister in Help/About Excel/System Info which did show my DLL as 'registered'. But the lister is discreet about where DLLs are registered. Not inside Excel, I guess.

    Regards,
    John
    Originally posted by John Weinland:
    My 28-line foo.dll in debug mode stops on
    line 29 with the message, "Error 505: (...)
    Debugging requires EXE file, not DLL."
    I have interpreted this as encouragement to
    compile and debug in conjunction with the
    calling EXE, but Error 505 does not seem to be
    covered in the online guide.
    When called by the EXE, foo.dll returns VB5
    "Run-time error 48: File not found. foo.dll"
    Results are the same when run inside VB5 and
    out, with or without a full path.
    Foo.dll has 3 simple functions like the
    following:
    FUNCTION RND2LONG ALIAS "Rnd2Long" (BYVAL x AS LONG) EXPORT AS LONG
    Each is called from a .bas declare like:
    Declare Function Rnd2Long Lib "FOO.DLL" Alias _
    "RND2LONG" (ByVal x As Long)

    I am new to DLLs and very stumped!



    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    Ahha! It's not surprising that is failed in that case, as LIBMAIN (or its synonym DLLMAIN) must return TRUE (non-zero) or Windows assumes the DLL failed to initialize itself during %DLL_PROCESS_ATTACH. This gives a DLL a way to prohibit itself from loading, due to say, licensing or memory requirement failures, etc.

    If you have to pick a good trap to fall into, then this would be the one!

    See the documentation for more information on constructing a LIBMAIN/DLLMAIN function.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Aaron MacLEod
    Guest replied
    This was my problem i left this declared so i could
    use it later for initialization. I dont know why having this
    in the Dll would cause the "file not found", but once i removed
    it everything worked fine.

    FUNCTION LibMain(BYVAL hInstance AS LONG, _
    BYVAL Reason AS LONG, _
    BYVAL Reserved AS LONG) EXPORT AS LONG
    END FUNCTION

    ------------------

    Leave a comment:


  • Knuth Konrad
    replied
    John,

    make also sure that any DLL used by FOO.DLL can be located by VB. If you're running the VB app from within the IDE the application path for the VB app is the VB path. If stumbled across this behaviour quit a couple of times.

    Knuth

    ------------------
    http://www.softAware.de

    Leave a comment:


  • Lance Edmonds
    replied
    Aaron, VB has a tendancy to misreport the actual error.. it is well known to report "File Not Found" when the real error should have been "Missing Entry Point".

    If you are still having problems, then post the VB & PB declarations, and we should be able to sort it out for you.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Jeffrey R. Radue
    Guest replied
    I,m not sure how you are declaring your function, however I use this format
    and it works perfectly.

    PB:FUNCTION RND2LONG ALIAS "Rnd2Long" (BYVAL x AS LONG) EXPORT AS LONG
    VB eclare Function Rnd2Long Lib "FOO.DLL" (ByVal x As Long) AS LONG

    The alias in the VB declaration is reduntant since PB is declaring the alias.

    If you call th PB function from another PB DLL then
    Lance's original declaration is necessary.


    ------------------

    Leave a comment:


  • Aaron MacLEod
    Guest replied
    Im also getting the "file not found error"
    but ive made sure the ALIAS in PB matches the ALIAS in VB

    John's ALIAS was incorrect but that would generate

    "run-time error '453' can't find DLL Entry point
    <FunctionName> in <DLL>

    Ive tried putting the DLL in the system directory
    but still get the same file not found error


    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    Your VB ALIAS should use the same case as the ALIAS in the PB code:
    Code:
    PB:
    FUNCTION RND2LONG ALIAS "Rnd2Long" (BYVAL x AS LONG) EXPORT AS LONG
     
    VB:
    Declare Function Rnd2Long Lib "FOO.DLL" Alias "Rnd2Long" (ByVal x As Long) [b]AS LONG[/b]
    If you omit the ALIAS in the PB code, you would do it this way:
    Code:
    PB:
    FUNCTION Rnd2Long (BYVAL x AS LONG) EXPORT AS LONG
     
    VB:
    Declare Function Rnd2Long Lib "FOO.DLL" Alias "RND2LONG" (ByVal x As Long) [b]AS LONG[/b]
    Finally, I noted that your VB code omitted the AS LONG return specifier... I added it for clarity.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • John Weinland
    Guest started a topic Run-time error: File not found. foo.dll

    Run-time error: File not found. foo.dll

    My 28-line foo.dll in debug mode stops on
    line 29 with the message, "Error 505: (...)
    Debugging requires EXE file, not DLL."
    I have interpreted this as encouragement to
    compile and debug in conjunction with the
    calling EXE, but Error 505 does not seem to be
    covered in the online guide.
    When called by the EXE, foo.dll returns VB5
    "Run-time error 48: File not found. foo.dll"
    Results are the same when run inside VB5 and
    out, with or without a full path.
    Foo.dll has 3 simple functions like the
    following:
    FUNCTION RND2LONG ALIAS "Rnd2Long" (BYVAL x AS LONG) EXPORT AS LONG
    Each is called from a .bas declare like:
    Declare Function Rnd2Long Lib "FOO.DLL" Alias _
    "RND2LONG" (ByVal x As Long)

    I am new to DLLs and very stumped!

    ------------------
Working...
X