Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 22nd, 2005, 4:17 PM   #1
amrfathy_egy
Newbie
 
Join Date: Jan 2005
Posts: 3
Rep Power: 0 amrfathy_egy is on a distinguished road
Linking dll failure (file not found)

i've been trying to link a dll file written with VC++ to VB6 ..
but it keeps telling me error 53 "file not found"

i tried making an ordinary dll file in VC and link it to VB it worked perfectly (it contained a small program adding 2 values), but when i try to link my dll file it refuses telling me "file not found"

note that my dll file contains many functions and takes many variables, also it calls other dll files from that dll

the code i wrote in VB was
in declaration:
Private Declare Function Core Lib "CoreDll.dll" (ByVal File_Name As String, ByVal width_resized As Integer, ByVal height_resized As Integer, ByVal PaperROIWidth As Integer, ByVal PaperROIHeight As Integer, ByVal CornerWidth As Integer, ByVal CornerHeight As Integer, ByVal CornerArea As Integer, ByVal CornerVar As Integer, ByVal Num_Questions As Integer, ByVal Num_Answers As Integer, ByVal AnsxStart1 As Integer, ByVal AnsxStart2 As Integer, ByVal AnsyStart As Integer, ByVal AnsxShift As Integer, ByVal AnsyShift As Integer, ByVal AnsWidth As Integer, ByVal AnsHeight As Integer, ByVal AnsAreaThr As Integer, ByVal SecStartY As Integer, ByVal SecStartX1 As Integer, ByVal SecStartX2 As Integer, ByVal BNStartX1 As Integer, ByVal BNStartX2 As Integer, ByVal SecBNWidth As Integer, ByVal SecBNHeight As Integer, ByVal SecBNAreaThr As Integer) As Integer

and i called it with the line ..

X = Core("Ans-Exam_Networks-Model9.BMP", 778, 1100, 700, 1000, 70, 70, 100, 40, 60, 4, 78, 463, 131, 59, 27, 30, 30, 100, 74, 286, 315, 385, 414, 14, 21, 5)

so VB halts at that line (the call one)

i've been trying to know where the problem is for several days with no success.

thank you
amrfathy_egy is offline   Reply With Quote
Old Jan 23rd, 2005, 7:47 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I'm no expert on DLLs, but perhaps it's "Ans-Exam_Networks-Model9.BMP" that doesn't exist?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 23rd, 2005, 4:17 PM   #3
amrfathy_egy
Newbie
 
Join Date: Jan 2005
Posts: 3
Rep Power: 0 amrfathy_egy is on a distinguished road
No .. i'm sure it exists

I'm sure that every file is in its place
amrfathy_egy is offline   Reply With Quote
Old Jan 23rd, 2005, 5:27 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Is the message box that pops up from VB or the C++ DLL?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 28th, 2005, 5:35 PM   #5
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Error 53 is from Visual Basic and it means it can't find your DLL. It must be located in one of two places - the %systemroot% (windows\system32 for NT) or the same folder as the executable. If running within VB, it must be in the same folder as the project ('vbp') file. Try adding the line chdir(app.path) before you call the function. If that still doesn't work, try replacing the Lib field with the absolute path to see if that works.

There doesn't appear to be any conventional way of dynamically assigning the Lib field at run-time - it must be a string constant - if your problems still persist, I'd recommend using COM instead of __stdcall, as CreateObject() in VB is much more flexible (and up to date).

Hope this helps
Rory is offline   Reply With Quote
Old Jan 28th, 2005, 5:50 PM   #6
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Oh, and if that doesn't work, this might - type the following into the Run dialog box:
regsvr32 <path to DLL>\CoreDll.dll
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Jan 28th, 2005, 6:13 PM   #7
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Actually, regsvr32 only works on self-registering COM components (i.e. ActiveX) that conform to the __stdcall. It won't help - DLL's do not need to be "registered" as such. Regsvr32 doesn't actually do anything special anyway, it's just a special case of rundll32 - it looks for a entry point called DLLRegisterServer, making the DLL responsible for registering itself in the COM registry.

Error 53 means that VB can't find the file specified by Lib, for which regsvr32 is no help - An error such as "ActiveX Component can't create object" would be the sort of thing caused by a registration issue that regsvr32 could solve.
Rory is offline   Reply With Quote
Old Jan 28th, 2005, 6:15 PM   #8
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Anway...

If your DLL just adds numbers, is that anything you couldn't do in VB anyway - why do you need a DLL. It's just another part of the program to go missing.
Rory is offline   Reply With Quote
Old Feb 3rd, 2005, 3:13 AM   #9
Florin
Newbie
 
Join Date: Feb 2005
Location: Brasov - ROMANIA
Posts: 1
Rep Power: 0 Florin is on a distinguished road
This problem is not because the first VC DLL. The responsible for error is another DLL that the CoreDLL.dll calls. The same problem I have. I don't know to resolve. Erase the outside function from CoreDLL.dll and error disapear.
Florin is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC