Author Topic: QB64 Critical Error, cannot find Dynamic Library File  (Read 5222 times)

0 Members and 1 Guest are viewing this topic.

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
QB64 Critical Error, cannot find Dynamic Library File
« on: September 26, 2018, 12:16:41 pm »
I am a user of the Velleman k8055 and K8061 for a number of projects and I have had very good results. I have a HomeManagment system with weather station that I am using the K8061. It is working good on my Desktop.
I also have a laptop Dell Latitude E6420 that I want to use for a backup Computer for my HomeManager as well as other projects. Using the same program that I use on the desktop, I get a Critical Error(see attachment) on my QB64 program (on the laptop) saying that it cannot find the dynamic library file, K8061.dll and mpusbapi.dll. I have them in the System32 folder as well as the SysWOW64 folder and the folder that the basic file is located. The K8055 and K8061 Demo from Velleman works great! I have also installed the driver as an unsigned driver.

Trying to simplify the problem, I stripped everything from the QB64 program and found that I get the error if I have these lines in the program…
DECLARE DYNAMIC LIBRARY “k8061”
END DECLARE
Then I get the error, otherwise I do not.
I have put in the 2 dll’s required,k8061.dll and mpusbapi.dll, in the folders as described above.
As you can see the QB64 gives an immediate Critical error message.
What could be the problem with the laptop?
Thanks for your help...Rog

FellippeHeitor

  • Guest
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #1 on: September 26, 2018, 12:27:31 pm »
DECLARE DYNAMIC LIBRARY “k8061”
    'you must declare the procedures you want to use from the DLL here.
    'do you have any SUB/FUNCTION lines inside this block?

END DECLARE


Check out some samples of DECLARE LIBRARY at http://qb64.org/wiki/Windows_Libraries

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #2 on: September 26, 2018, 12:30:55 pm »
yes I have functions in the proceedure, I was trying to simplify.
DECLARE DYNAMIC LIBRARY "k8061"
    FUNCTION OpenDevice&
    FUNCTION PowerGood& (BYVAL a AS LONG)
    FUNCTION Connected& (BYVAL a AS LONG)
    FUNCTION ReadAnalogChannel& (BYVAL a AS LONG, BYVAL b AS LONG)
    FUNCTION ReadAllDigital& (BYVAL a AS LONG)
    FUNCTION ReadDigitalChannel& (BYVAL a AS LONG, BYVAL b AS LONG)
    FUNCTION OutputAllDigital& (BYVAL a AS LONG, BYVAL b AS LONG)
    FUNCTION SetDigitalChannel& (BYVAL a AS LONG, BYVAL b AS LONG)
    FUNCTION ReadAllAnalog& (BYVAL a AS LONG, Array AS LONG)
    FUNCTION CloseDevice& (BYVAL a AS LONG)
    FUNCTION CloseDevices&
END DECLARE

This all runs fine on my Desktop PC it seems the problem is only on the laptop, does not be able to find the dll's for some reason?

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #3 on: September 26, 2018, 12:44:02 pm »
To be clear the laptop runs the Velleman Demo for the K8055 and the K8061 just great.
The K8055 just uses the K8055.dll
The K8061 uses 2 dll's K8061.dll and Kmpusbapi.dll plus a unsigned driver.
I only have the problem when I declare the Function(?)
DECLARE DYNAMIC LIBRARY "k8061"
    FUNCTION OpenDevice&
    FUNCTION CloseDevices&
END DECLARE

FellippeHeitor

  • Guest
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #4 on: September 26, 2018, 12:47:40 pm »
Try registering the .DLL with regsvr32 name.dll or, alternatively, place it in QB64's folder (and ship them with your binary when you distribute).

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #5 on: September 26, 2018, 01:04:39 pm »
In trying to register the dll in the system32 folder i got "The module "k8061.dll" was loaded but the entry point was not found. Make sure the "K8061.dll is a valid DLL or OCX file and then try again.
(also the same response with the mpusbapi.dll)

In trying to register the dll in the sysWOW64 folder i got "The module "k8061.dll" was loaded but the entry point was not found. Make sure the "K8061.dll is a valid DLL or OCX file and then try again.
(also the same response with the mpusbapi.dll)

I had them in the QB64 folder.

I am Not sure what you mean by this.. (and ship them with your binary when you distribute).

FellippeHeitor

  • Guest
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #6 on: September 26, 2018, 01:06:15 pm »
I meant: if it works having them in your QB64 folder, you will always keep them alongside your .exe if you want to distribute your program.

I'm in the dark here as to why it won't work. Maybe someone else will have seen this.

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #7 on: September 26, 2018, 01:10:48 pm »
Thanks for you prompt attention, it is Greatly Appreciated!
Rog

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #8 on: September 26, 2018, 01:29:43 pm »
A few things which I can think of here:

1) Simplest issue is just the DLL not being found.  Try the path as "./k8061".  If that doesn't work, hardcord the whole path, just for testing.   DECLARE LIBRARY "c:/QB64/any subfolder/k8061"

2) Make certain that the dll works with the OS version.  Some 32-bit dlls don't want to work properly on 64-bit systems, and vice-versa.  If your laptop is 32-bit and your PC is 64, that may be the issue (especially when dealing with _OFFSETs).

3) Just make certain the dll itself hasn't became corrupted somehow.  It's rare, but it does happen.

And if not one of those....  I dunno, without further testing to try and reproduce the issue.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #9 on: September 26, 2018, 01:43:35 pm »
SMcNeill,
I tried the path as "./k8061", didn't work..

DECLARE LIBRARY "c:/QB64/any subfolder/k8061"???
Do I do this in the QB64 basic program or ???
or tell me where to find info., Thanks for your help!!


Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #10 on: September 26, 2018, 03:58:18 pm »
Try...

DECLARE DYNAMIC LIBRARY "C:\Windows\System32\k8061.dll"
    FUNCTION OpenDevice&
    FUNCTION CloseDevices&
END DECLARE

If your drive isn't C, change that to whatever your Windows laptop drive is. If that can't be found, search it in Explorer to find the correct path k8061.dll is in. If it works, I'd say chances are the dll is registered in your desktop, but not registered in your laptop. I think I've only encountered a problem like this once, quite some time ago, so my thought was to hard code the path, as in this example, and everything worked fine. Anyway, I'm far from an expert here.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #11 on: September 26, 2018, 04:44:15 pm »
I tried including the file address, my laptop still did not find the file.....

I get an error immediatly in the QB64 browser if I use
DECLARE DYNAMIC LIBRARY "C:\Windows\System32\k8061.dll"

I get no error if I use
DECLARE DYNAMIC LIBRARY "C:\Windows\System32\k8061" (No .dll)
Then the browser is ok with the statement , but, it still does not work with the same as my initial  symptoms.

Still unable to find the .dll file??




FellippeHeitor

  • Guest
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #12 on: September 26, 2018, 04:54:23 pm »
The extension must be omitted, so no .dll is the way to go.

If even with the full path you still get errors, then it's something else entirely.

Quote
2) Make certain that the dll works with the OS version.  Some 32-bit dlls don't want to work properly on 64-bit systems, and vice-versa.  If your laptop is 32-bit and your PC is 64, that may be the issue (especially when dealing with _OFFSETs).

You didn't address what Steve mentioned above yet. Are both systems identical?

Also: Did you install something on one and just copy over to the other? Could be that.

Offline RogSyk

  • Newbie
  • Posts: 8
    • View Profile
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #13 on: September 26, 2018, 05:28:00 pm »
Ok, Both systems are 64 bit systems.

The systems are Not identical, but the application should work on both of them.

Thank You, Thank You, Thank You

I found it, On the web site Vellman has 2 dll files, 1 larger and 1 smaller, I thought my desktop had the larger file, that worked.
Thanks to Steve and Fellippe I checked again. It was using the smaller dll file. I put that file in my laptop and was able to run the basic program and have it find the dll file. It is not reading the card correctly as yet, but, that's another issue!
Thanks Again,
Rog

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 Critical Error, cannot find Dynamic Library File
« Reply #14 on: September 26, 2018, 07:50:20 pm »
Ok, Both systems are 64 bit systems.

The systems are Not identical, but the application should work on both of them.

Thank You, Thank You, Thank You

I found it, On the web site Vellman has 2 dll files, 1 larger and 1 smaller, I thought my desktop had the larger file, that worked.
Thanks to Steve and Fellippe I checked again. It was using the smaller dll file. I put that file in my laptop and was able to run the basic program and have it find the dll file. It is not reading the card correctly as yet, but, that's another issue!
Thanks Again,
Rog

Glad you figured it out.  If there's anything else we can do to help, just let us know.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!