Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hello,

For some reason, I keep on getting "dll not found" in Windows 7. I am using Visual C++ 2010 express along with V5.0 Mysql connection/c api. I have a dll project with the following. Everything compiles find with the correct include/lib for mysql. However, whenever I try to access the fntestdll function, I get "dll not found". I have put it in c:\windows\system32 and also c:\windows\syswow64 but nothing seems to make a difference. What am I doing wrong?

C++
/********************   testdll.cpp file************************/
#include "stdafx.h"
#include "testdll.h"
#include <stdio.h>
#include <stdlib.h>
#include <WinSock.h>
#include <iostream>
#include <c:/mysql/include/mysql.h>

using namespace std;
MYSQL *connection, mysql;

TESTDLL_API int fntestdll(void)
{
    mysql_init(&mysql);
    return 0;
}


C++
/************************** Testdll.h file*****************************/
#define TESTDLL_API __declspec(dllexport)

TESTDLL_API int fntestdll(void);
Posted
Updated 26-Jan-11 6:46am
v2

The first thing I'd try is placing the mysql DLL in the same directory as your own DLL. Then I would use a dll dependency walker[^] to check that your DLL can find other DLLs on which it depends.
 
Share this answer
 
Comments
Steve Maier 26-Jan-11 12:59pm    
I have found that sometimes this error means the DLL that you are loading needs more dlls there as well. Great suggestion - have a 5.
JF2015 28-Jan-11 2:42am    
Don't know why this good answer was low-voted. Have my 5 to compensate.
Is your dll in the path? If not, that is your problem.
 
Share this answer
 
May be problem is that library has no manifest?
 
Share this answer
 
What do you mean library has no manifest?

Also, the dll is in the path.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900