bail3yz
asked on
Runtime error 48 file not found C++ DLL
I have a VB app that uses a dll I made in C++
it works perfect on this computer
however when I try to run it on another computer... it says it cant find the C++ DLL even tho its in the same folder (runtime error 48)..
Any suggestions to solve either problem?
I tried to install C++ package, and VB runtime dll package on other computer
MORE INFO:
So I figured out that error 53 means the file isnt there
error 48 means another dll that the dll uses isnt there
so I used process monitor to monitor the process and see where it fails
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
turns out it fails when trying to load ntdll.dll from the system32 folder..
I checked and it was there..
however on my main computer. its a 1.2mb file.. on the other computer its 700kb..
I wonder what the difference is?
my dll is very simple.. all it does is use iostream and fstream
main comp is winxp 64bit sp 2
2nd comp is winxp pro sp3
it works perfect on this computer
however when I try to run it on another computer... it says it cant find the C++ DLL even tho its in the same folder (runtime error 48)..
Any suggestions to solve either problem?
I tried to install C++ package, and VB runtime dll package on other computer
MORE INFO:
So I figured out that error 53 means the file isnt there
error 48 means another dll that the dll uses isnt there
so I used process monitor to monitor the process and see where it fails
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
turns out it fails when trying to load ntdll.dll from the system32 folder..
I checked and it was there..
however on my main computer. its a 1.2mb file.. on the other computer its 700kb..
I wonder what the difference is?
my dll is very simple.. all it does is use iostream and fstream
main comp is winxp 64bit sp 2
2nd comp is winxp pro sp3
ASKER
Hi Richard,
Thanks for the reply.. yes the machine has the C++ runtime installed.
Thanks for the reply.. yes the machine has the C++ runtime installed.
Is the application you compiled 64-bit or 32-bit? If it is 64-bit, it will not work on the target 32-bit machine.
Thanks
Thanks
ASKER
Hi,
as far as I know its 32bit.. but I am a C++ newb.. is there a way to check?
its a very simple dll that just reads a file and calculates some numbers.
as far as I know its 32bit.. but I am a C++ newb.. is there a way to check?
its a very simple dll that just reads a file and calculates some numbers.
Did you compile it? If so, in Visual Studio, you can check like this:
Open your C++ project
Choose Build->Configuration Manager menu
Check the 'Active solution platform’ and see what it says.
Thanks
Open your C++ project
Choose Build->Configuration Manager menu
Check the 'Active solution platform’ and see what it says.
Thanks
ASKER
Hi, it says win32
How are you trying to install the application?
ASKER
its just an exe with a dll.. so i just put them both on the server..
prior to this.. i used the exe on the server all the time.. now it uses this dll also.
to isolate the issue.. I made a new exe.. that does nothing but call a function from the dll.
prior to this.. i used the exe on the server all the time.. now it uses this dll also.
to isolate the issue.. I made a new exe.. that does nothing but call a function from the dll.
Have you tried this on any other machines?
ASKER
Nope.. I will likely try it on my laptop shortly.. if no one can come up with any other ideas..
I find the ntdll.dll to be interesting
I find the ntdll.dll to be interesting
If it is just those two files, i'll give it a quick go to see what I see if you would like
ASKER
I forgot to mention the dll loads a large data file (too large to send)..
but I suppose that would give a different error anyways.. so we can still test this
pokerstove.zip
but I suppose that would give a different error anyways.. so we can still test this
pokerstove.zip
Thanks for that. I'm getting the 48 error too.
What code have you used to link to the DLL?
Thanks
What code have you used to link to the DLL?
Thanks
ASKER
Tried it on my laptop.. winxp sp2
same runtime error 48
same runtime error 48
ASKER
Public Declare Sub InitTheEvaluator Lib "pokerstove.dll" ()
ASKER
if you delete pokerstove and try to run project1.exe.. you get runtime error 53..
so i guess 53 means the file actually isnt there
and 48 means something else
so i guess 53 means the file actually isnt there
and 48 means something else
You are using visual basic .NET 2.0?
ASKER
I am using VB 6.0
and Visual Studio C++ 2008
and Visual Studio C++ 2008
OK.
What is the code for your DLL?
What is the code for your DLL?
ASKER
what do you mean? the entire code?
I use this method to make functions callable
LIBRARY "pokerstove"
EXPORTS
InitTheEvaluator @1
GetHandValue @2
GetHandValue2 @3
void _stdcall InitTheEvaluator()
{
memset(HR, 0, sizeof(HR));
FILE * fin = fopen("HANDRANKS.DAT", "rb");
// Load the HANDRANKS.DAT file data into the HR array
size_t bytesread = fread(HR, sizeof(HR), 1, fin);
fclose(fin);
}
Keep in mind this works on my computer, so I dont think this is the problem.. also this isnt even the original install of windows that the dll was developed on.. as I just recently reinstalled
I use this method to make functions callable
LIBRARY "pokerstove"
EXPORTS
InitTheEvaluator @1
GetHandValue @2
GetHandValue2 @3
void _stdcall InitTheEvaluator()
{
memset(HR, 0, sizeof(HR));
FILE * fin = fopen("HANDRANKS.DAT", "rb");
// Load the HANDRANKS.DAT file data into the HR array
size_t bytesread = fread(HR, sizeof(HR), 1, fin);
fclose(fin);
}
Keep in mind this works on my computer, so I dont think this is the problem.. also this isnt even the original install of windows that the dll was developed on.. as I just recently reinstalled
ASKER
would you like to take a look at the dll code? maybe youll spot something
Could do.
Have you had it working with a blank DLL? IE, a function with no code in it?
Have you had it working with a blank DLL? IE, a function with no code in it?
ASKER
I never tested that... I will upload the code and test that right away
ASKER
blah it wont let me upload it .. doesnt let you upload these files for some reason
ASKER
also i tested calling a blank function.. same error
ASKER
Try testing with no other code but one blank function. The error could be to do with a dependancy somewhere. Also, in the def file, try removing the " from the name
ASKER
Tried it
the code was literallly
void _stdcall InitTheEvaluator()
{
}
LIBRARY pokerstove
EXPORTS
InitTheEvaluator @1
and still same error
the code was literallly
void _stdcall InitTheEvaluator()
{
}
LIBRARY pokerstove
EXPORTS
InitTheEvaluator @1
and still same error
Hmm...
Try following this tutorial and let us know if it works. There is something amis here..
http://www.developerfusion.com/article/1973/calling-a-c-dll-from-visual-basic/
Thanks
Try following this tutorial and let us know if it works. There is something amis here..
http://www.developerfusion.com/article/1973/calling-a-c-dll-from-visual-basic/
Thanks
ASKER
What is the point of doing that?
I am just wondering what your thought process is.. or are you just guessing and checking?
I dont see the logic in doing that.. if it works on 1 computer.. I dont think anything is wrong with the dll itself.. nor the VB project.. most likely the computer is missing something it needs.
I am just wondering what your thought process is.. or are you just guessing and checking?
I dont see the logic in doing that.. if it works on 1 computer.. I dont think anything is wrong with the dll itself.. nor the VB project.. most likely the computer is missing something it needs.
ASKER
I could be wrong, but I would just like to know what you're thinking
I am assuming that that tutorial is kosha - so if that works, then there is something missing from the development process. If it doesn't, then it is the computer.
Sorry, I'm trying to narrow down exactly where the problem lay.
Sorry, I'm trying to narrow down exactly where the problem lay.
ASKER
skimmed through the tutorial.. thats exactly how I made the dll.. I used a very similar tutorial
I thought so.
When you run the program on your machine, does it work if you double click the exe, or just when you debug the app?
When you run the program on your machine, does it work if you double click the exe, or just when you debug the app?
ASKER
both
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Interesting!.. I was just thinking that the only major software difference between these machines is this one has visual studio...
I tried to use the package/deploy wizard in VB6 and it keeps freezing haha.. I wonder if theres any other way to do it?
btw Richard, I appreciate all the help!
I tried to use the package/deploy wizard in VB6 and it keeps freezing haha.. I wonder if theres any other way to do it?
btw Richard, I appreciate all the help!
ASKER
hahah figured it out.. blag..
*facepalm*
I had the C++ compile set to debug or whatever instead of release..
the release uses the C++ runtime stuff you download..
the debug uses stuff thats with the compiler
*facepalm*
I had the C++ compile set to debug or whatever instead of release..
the release uses the C++ runtime stuff you download..
the debug uses stuff thats with the compiler
I am pleased you found your solution :)
Does your target machine have the C++ runtime installed? If you developed using Visual Studio, you may have to also install the runtime. See here for more details (depending on which Visual Studio version you used):
Visual Studio 2008:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
Visual Studio 2005:
http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
Thanks,
Richard Hughes