Thread: Explicit DLL load

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    8

    Explicit DLL load

    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?
    Last edited by Kamil_; 08-03-2011 at 09:43 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. explicit keyword
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2007, 01:57 PM
  2. Explicit keyword
    By Mario F. in forum C++ Programming
    Replies: 5
    Last Post: 06-30-2006, 06:43 PM
  3. explicit
    By Trauts in forum C++ Programming
    Replies: 4
    Last Post: 05-16-2003, 07:58 PM
  4. Implicit and Explicit
    By ripper079 in forum C++ Programming
    Replies: 2
    Last Post: 09-06-2002, 12:22 PM