I am trying to create a DLL in codeblocks, and use it in VB.net, but I have been having issues getting the DLL to work. I have created a very simple DLL to test with, and wondering if anyone would know of any settings or anything else that may be causing the issue.
The cpp file:
#include "main.h"
// a sample exported function
int DLL_EXPORT SomeFunction()
{
return 5;
}
The header file:
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
/* To use this exported function of dll, include this header
* in your project.
*/
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
int DLL_EXPORT SomeFunction();
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__
I call the function into VB.net like this:
Class DLL_Functions
Public Declare Function SomeFunction Lib "C:\Users\Owner\Desktop\Header Test\test\bin\Debug\test.dll" () As Integer
End Class
When I go to run the function I get an error: "Unable to load DLL. The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
I have checked just to ensure the file path is correct as well.