Board.KolibriOS.org

Официальный форум KolibriOS
Текущее время: Вт дек 12, 2017 10:39 pm

Часовой пояс: UTC+03:00




Начать новую тему  Ответить на тему  [ 8 сообщений ] 
Автор Сообщение
 Заголовок сообщения: Problem when loading several libraries, wich use libraries.
СообщениеДобавлено: Вс апр 15, 2012 2:10 pm 
Не в сети
Mentor/Kernel Developer
Аватара пользователя

Зарегистрирован: Пт июн 30, 2006 9:01 am
Сообщения: 1232
I first discovered the problem when writing 'synergyc' application for net branch, some time ago.
This program uses several libraries (console, libini and network library).
Network library uses libini, wich in turn uses libio.

The problem is that libio in libini doesnt load correctly (and perhaps others too).
Thus, when calling ini_get_str, my program crashes because libini trys to call [file.open] (libio) but its value is -1.

Back when i first discovered the problem, I discussed it with diamond, who blamed the problem on a design flaw IIRC.
Since he is no longer here, but the problem is, somebody else will need to fix it.

Does anybody here have more information or insight about this problem ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Вернуться к началу
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Вс апр 15, 2012 4:16 pm 
LibINI uses its own copy of LibIO. Thus, for example, Tinypad has two copies LibIO.

How do you use LibIO?


Вернуться к началу
   
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Вс апр 15, 2012 4:22 pm 
Не в сети
Mentor/Kernel Developer
Аватара пользователя

Зарегистрирован: Пт июн 30, 2006 9:01 am
Сообщения: 1232
If what I remember is correct, it has to do with lib_init being called multiple times for the same library.
I do not think it's a kernel problem.

BUT.. I havent investigated any of these claims as of yet,
I was hoping somebody here knows more about the dll loading mechanism then I currently do.. :)

The program synergyc does not use libio itself.
BTW: I tought that the dll's are only loaded in memory once ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Вернуться к началу
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Вс апр 15, 2012 5:17 pm 
DLL is loaded into memory only once:
1) if the path to the file system is the same.
2) if the library does not change the memory in its own area, where it has its own code.

LibIO and LibINI violate Rule 2. For this reason, the kernel makes a copy of these libraries for each application.

lib_init is actually a very harmful thing. And for example in box_lib is imitation - you did it. For this reason, the mechanism of the DLL into the kernel does not duplicate Box_Lib.


Вернуться к началу
   
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Вс апр 15, 2012 5:49 pm 
Не в сети
Mentor/Kernel Developer
Аватара пользователя

Зарегистрирован: Пт июн 30, 2006 9:01 am
Сообщения: 1232
Mario писал(а):
DLL is loaded into memory only once:
1) if the path to the file system is the same.
2) if the library does not change the memory in its own area, where it has its own code.

LibIO and LibINI violate Rule 2. For this reason, the kernel makes a copy of these libraries for each application.

lib_init is actually a very harmful thing. And for example in box_lib is imitation - you did it. For this reason, the mechanism of the DLL into the kernel does not duplicate Box_Lib.


So every library, wich uses another library suffers the problem (2) ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Вернуться к началу
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Вс апр 15, 2012 6:19 pm 
If the library does not need a call to lib_init, then the question is not relevant.


Вернуться к началу
   
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Чт апр 19, 2012 6:36 pm 
Не в сети
Mentor/Kernel Developer
Аватара пользователя

Зарегистрирован: Пт июн 30, 2006 9:01 am
Сообщения: 1232
Here is some debugging output I generated.

The way I see it, libini tries to read proc addresses from libio twice. There is no error checking mechanism and on the second call of dll.link, proc addresses get screwed up ?


Вложения:
Clipboard01.gif
Clipboard01.gif [ 10.07 КБ | 1771 просмотр ]

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
Вернуться к началу
 Заголовок сообщения: Re: Problem when loading several libraries, wich use librari
СообщениеДобавлено: Чт апр 19, 2012 10:57 pm 
This is very strange behavior. Most recently, I used LibINI for @PANEL (SVN r.2619 and following) and it is no have problem.
Maybe it makes sense to try a macro SVN_Kolibri\programs\develop\libraries\box_lib\load_lib.mac ?


Вернуться к началу
   
Показать сообщения за:  Поле сортировки  
Начать новую тему  Ответить на тему  [ 8 сообщений ] 

Часовой пояс: UTC+03:00


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Limited
Русская поддержка phpBB