questions covering dynamic use of DLL
I wrote a little program to load txt file, than sort out all included numbers and create output file.
I also need to add Transform.dll which contains one function i necessarily need to use. When I try to compile
I see a message error C3861: 'Transform': identifier not found, but i think i had included an identifier.
Here is the code
#include<string>
#include<fstream>
#include<iostream>
#include<vector>
#include<sstream>
#include<windows.h>
//#define DLL_EXPORT extern "C" __declspec( dllexport )
using namespace std;
typedef DWORD (*funcTransform)(DWORD);
vector<DWORD> v1;
DWORD x;
string line;
long c[600000];
unsigned int k=0;
void sort(void);
void load_file(void);
void create_output(void);
int main(){
HINSTANCE hDll=LoadLibrary("Transform.dll");
//funcTransform Transform;
if(hDll==NULL)
cout<<"Dll error"<<endl;
else
funcTransform Transform=(funcTransform)GetProcAddress(hDll,"Tran sform");
load_file();
sort();
create_output();
FreeLibrary(hDll);
}
void load_file(void){
long a;
ifstream in("input.txt");
while(getline(in,line)){
stringstream s(line);
s >> a;
c[k]=a;
k++;
}
}
void sort(void){
unsigned int i,j;
unsigned int top;
for(i=1;i<k;i++){
top=c[i];
j=i-1;
while((top<c[j])&&j>=0){
c[j+1]=c[j];
j--;
}
c[j+1]=top;
}
}
void create_output(void){
ofstream out("output.txt");
for(long d=0;d<k;d++){
x=c[d];
out<<Transform(x)<<endl;
}
}
Any Ideas?