Hi every body,
I have a big problem. here a test code of Dll :
main.h
#pragma once
#define BUILD_DLL
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
BOOL DLL_EXPORT Exe(int i);
#ifdef __cplusplus
}
#endif
Dll.cpp :
#include <Windows.h>
#include "main.h"
BOOL DLL_EXPORT Exe(int i){
int a = i;
return TRUE;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
And the application code looks like this :
#include <Windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
HMODULE hmodule;
hmodule = LoadLibraryEx("Dll.dll", NULL, 0);
if (hmodule == NULL)
{
printf("Fail : %d", GetLastError());
}
else
printf("Loaded");
int i;
scanf("%d", &i);
return 0;
}
Here is the problem :
I compile this dll code under VS 2015 community with the following parameter to avoid some dependency files :
- no precompiled header
- Multi thread Dll
- Multi bytes char set
- Use standard windows library
- platform toolset : Visual Studio 2015 - Windows XP (v140_xp)
After the compilation i test the application :
under windows 8.1 : Ok, i have the loaded message :)
under windows 10 : KO , error 126 (no module found)
I take exactly the same code. I compile this with Code::Blocks (GCC) witht the default parameters for a DLL project :
windows 8.1 : OK, loaded message
windows 10 : OK, loaded message
... the same code. So i'm looking for a compilation option to modify somewhere , but i found nothing until now.
Any ideas ?
Thanks by advance and sorry for my bad english :)