Thread: a more advanced technique

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Registered User
    Join Date
    Oct 2007
    Posts
    242
    If you just wanna export functions from other files, just create a DLL and include it in your code with LoadLibrary.
    Then, get the function's address by using GetProcAddress.
    Something like this..
    dll.dll:
    Code:
    __cdecl(dllexport) void func()
    {
     cout << "Hello world!";
    }
    includedll.cpp:
    Code:
    typedef void (*myFunc)();
    myFunc func;
    HANDLE dll = LoadLibrary("dll.dll");
    func = (myFunc)GetProcAddress((HMODULE)dll, "func");
    func();
    FreeLibrary((HMODULE)dll);
    Last edited by eXeCuTeR; 07-29-2008 at 09:21 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A more advanced port scanner
    By fssp in forum C Programming
    Replies: 6
    Last Post: 03-23-2009, 01:14 AM
  2. What's advanced c++ contents ?
    By toysoldier in forum C++ Programming
    Replies: 8
    Last Post: 09-27-2004, 08:12 PM
  3. Advanced? Not Advanced? Anyone?
    By Jotun in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2004, 08:02 PM
  4. Advanced but yet general
    By Rhodium in forum C Programming
    Replies: 6
    Last Post: 08-09-2003, 12:46 PM
  5. Advanced Linux Programming
    By drdroid in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-24-2003, 02:01 PM