Re: Gtk::Module



>>>>> "Alexander" == Alexander Volosatov <rope-walker yandex ru> writes:

Alexander> Hello, Max.  You wrote 3 марта 2006 г., 21:28:41:

>>>>>>> "Alexander" == Alexander Volosatov <rope-walker yandex ru>
>>>>>>> writes:

>>>>> 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.

Alexander> Code of lib:

Alexander> #include <iostream>

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

Alexander> WHY FUNCTION IS NOT FOUND????

>> C++ compiler mangles function names thus you have to use C linkage
>> for functions your library exports:

>> extern "C" void func1() { bla-bla-bla }

Alexander> Thanks for averybody how helped me with this problem!!!!

Alexander, also remeber if you create objects in your dynmaicly loaded library
you must free them using function from that library (delete and new can be 
overloaded). I.e. library should provide functions:

Foo* foo_new (...);
void foo_delete(Foo*);

for each class it returns objects of to the main program. 

-- 
WBR,
Max Vasin.

NP: 




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