Link to home
Start Free TrialLog in
Avatar of bail3yz
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

Avatar of richard_hughes
richard_hughes
Flag of United Kingdom of Great Britain and Northern Ireland image

Hello bail3yz

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
Avatar of bail3yz
bail3yz

ASKER

Hi Richard,

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
Avatar of bail3yz

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.
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
Avatar of bail3yz

ASKER

Hi, it says win32
How are you trying to install the application?
Avatar of bail3yz

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.
Have you tried this on any other machines?
Avatar of bail3yz

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
If it is just those two files, i'll give it a quick go to see what I see if you would like
Avatar of bail3yz

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
Thanks for that. I'm getting the 48 error too.

What code have you used to link to the DLL?

Thanks
Avatar of bail3yz

ASKER

Tried it on my laptop.. winxp sp2
same runtime error 48
Avatar of bail3yz

ASKER

Public Declare Sub InitTheEvaluator Lib "pokerstove.dll" ()
Avatar of bail3yz

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
You are using visual basic .NET 2.0?
Avatar of bail3yz

ASKER

I am using VB 6.0
and Visual Studio C++ 2008
OK.

What is the code for your DLL?
Avatar of bail3yz

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
Avatar of bail3yz

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?
Avatar of bail3yz

ASKER

I never tested that... I will upload the code and test that right away
Avatar of bail3yz

ASKER

blah it wont let me upload it .. doesnt let you upload these files for some reason
Avatar of bail3yz

ASKER

also i tested calling a blank function.. same error
Avatar of bail3yz

ASKER

I put it on this FTP

ftp://24.76.204.171

user: bailey
pw: chris1234
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
Avatar of bail3yz

ASKER

Tried it

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
Avatar of bail3yz

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.
Avatar of bail3yz

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.
Avatar of bail3yz

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?
Avatar of bail3yz

ASKER

both
ASKER CERTIFIED SOLUTION
Avatar of richard_hughes
richard_hughes
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bail3yz

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!
Avatar of bail3yz

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
I am pleased you found your solution :)