Results 1 to 6 of 6

Thread: importing functions from DLL and making them global

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241

    importing functions from DLL and making them global

    I'm trying to import function from a DLL and make them global in my application. I can import them into one .cpp file, but then how do I let all the other files access the same functions? I can't make them external from within the .cpp. Do I have to import them into every single .cpp individually?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    You can import them within a header file I think..... then again I never use DLLs

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    I don't want to use an import library though, so I have to import them from within a function.

  4. #4
    Member
    Join Date
    Jun 2003
    Posts
    43

    Smile

    Hi friend,

    In a function import the function. Include the file where required. Call the function when required.
    I think its easy.
    Try and tell me if it happens..

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    If you mean by GetProcAddress, you can make the function pointer you assign to global across all files. E.g. for UpdateWindow:
    Code:
    main.cpp:
    void (WINAPI *ptrUpdateWindow)(HWND);
    
    // Later:
    ptrUpdateWindow = GetProcAddress(...);
    
    
    some.h:
    extern void (WINAPI *ptrUpdateWindow)(HWND);
    and you can use it everywhere you include some.h.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    thx, i think thats exactly what i want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width