ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Суббота
6 июля
157697 Топик полностью
testerplus (27.05.2009 15:16, просмотров: 54) ответил Alex B. на Есть функция, объявленная как inline extern, то есть всегда включаемая в код. Как создать отдельный вызываемый экземпляр этой функции без лишних действий? т.е. можно было бы объявить указатель на функцию и где-нить по нему ее вызвать - тогда компилер
В Юзерс Гайде по C30 (если ты о нем) в п. 2.3.3 сказано, что такое невозможно. Причем фокус с указателем, похоже, тоже не пройдет (если я правильно перевел) If you specify both inline and extern in the function definition, then the definition is used only for inlining. In no case is the function compiled on its own, not even if you refer to its address explicitly. Such an address becomes an external reference, as if you had only declared the function and had not defined it. This combination of inline and extern has a similar effect to a macro. Put a function definition in a header file with these keywords and put another copy of the definition (lacking inline and extern) in a library file. The definition in the header file will cause most calls to the function to be inlined. If any uses of the function remain, they will refer to the single copy in the library.