I don't know anything about your specific compiler but I think I can help you with standart mothood:
First the dll. Call it system.dll and write this:
Code:
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
extern "C" __declspec(dllexport) void Hello();
extern "C" __declspec(dllexport) void NumberList(int);
char name[70];
extern "C" __declspec(dllexport) void Hello()
{
cout << "\nHello from system.dll" << endl;
cout << endl << endl;
}
extern "C" __declspec(dllexport) void NumberList(int a)
{
GetModuleFileName(NULL,(LPTSTR)name,70);
cout << "Called from: " << name << endl << endl;
int i;
for (i=a; i<a+10; i++)
{
cout << i << " ";
}
cout << endl << endl;
}
This dll will exprot two functions.
Now the main console app:
Code:
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
typedef void (*pfunc1)();
typedef void (*pfunc2)(int);
pfunc1 One;
pfunc2 Two;
int main()
{
HINSTANCE hLib = LoadLibrary("system.dll");
if(hLib==NULL)
{
cout << "Error! Can't open dll!";
return 1;
}
char dllpath[70];
GetModuleFileName((HMODULE)hLib,(LPTSTR)dllpath,70);
cout << "Dll loaded:" << dllpath << endl;
One = (pfunc1)GetProcAddress((HMODULE)hLib, "Hello");
Two = (pfunc2)GetProcAddress((HMODULE)hLib, "NumberList");
if((One==NULL) || (Two==NULL))
{
cout << "Critical error! Can't load functions !" << endl;
FreeLibrary((HMODULE)hLib);
return 1;
}
One();
Two(50);
FreeLibrary((HMODULE)hLib);
getch();
return 0;
}
It should work on any compiler. Ask wich line you don't understand.