Hi ,
I am trying to call a method from unmanaged DLL in my C# client application.
I am getting this exception "An unhandled exception of type 'System.EntryPo intNotFoundExce ption' occurred in DLLInjection.ex e"
My C# Client code:
In Main()
IN C++ file.
Please help
I am trying to call a method from unmanaged DLL in my C# client application.
I am getting this exception "An unhandled exception of type 'System.EntryPo intNotFoundExce ption' occurred in DLLInjection.ex e"
My C# Client code:
Code:
public class ImportedFunction
{
[DllImport("C:\\CPP Project\\DLLInjection\\Debug\\Win32DLL.dll")]
public static extern int GetStorageName();
}
Code:
Console.Write("Calling Imported Function...");
int k=ImportedFunction.GetStorageName();
Code:
#define DllExport __declspec( dllexport)
extern "C" DllExport int __stdcall
GetStorageName();
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "dllmain.h"
#include<Windows.h>
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;
}
int __stdcall GetStorageName()
{
return 100;
}
Comment