Re: [OBORONA-SPAM] Re: Gtk::Module



>> Try this:

>> Glib::Module module("libfsdyn.dll");
  
>> if (module)
>> {
>>    void (*function)(void);
>>    cout << "Module found\n";
>>    module.get_symbol("func1", function);
>>    (*function)();
>> }


>> Bob

> It doesn't work.

Code of lib:

#include <iostream>

void func1()
{
     std::cout << "dll func\n";
}


and main program:

#include <iostream>
#include <glibmm.h>

using namespace std;

int main (int argc, char *argv[])
{
  cout << "Hello World!" << endl;
  
        Glib::Module module("libfsdyn.dll");
  
        if (module)
        {
                cout << "Module found\n";
                void (*function)(void);
                std::string str("func1");
                if (module.get_symbol(str, (void *&)function))
                {
                        cout << "function loaded\n";
                        function();
                }
                else
                {
                        cout << "fuction not loaded\n";
                }
        }
  
  cout << "Press ENTER to continue..." << endl; 
  cin.get();
  return 0;
}


log:
Hello World!
Module found
fuction not loaded
Press ENTER to continue...

WHY FUNCTION IS NOT FOUND????

-- 
 Alexander                          mailto:rope-walker yandex ru




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]