Skip to contentSkip to conversation

any point in defining classname_functionname() if not exporting it?

DISCUSSION Robert P. J. Day 2 participants 2 messages May 5, 2020 – May 19, 2020

lore
Share & tools
lore
#0 lore raw

still in BB manual, section 3.5.6, "Flexible Inheritance for Class
Functions", that section makes perfect sense but it's not clear if there is any value to defining a function of the form classname_functionmame() if you're not going to export it with EXPORT_FUNCTIONS.

case in point -- cmake.bbclass. at bottom of file, we see some
perfectly reasonable exporting:

EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file

but if you grep, there is an additional function being defined of that form:

cmake_do_generate_toolchain_file() {
cmake_do_configure() {
cmake_runcmake_build() { <-- this one
cmake_do_compile() {
cmake_do_install() {

sure, that function is invoked internally in that class file, but without being exported, is there any reason that function has a "cmake_" prefix?

rday

p.s. the same thing occurs in go.bbclass, if that's of any interest.

#1 lore raw
Quoted 22 lines · Robert P. J. Day

still in BB manual, section 3.5.6, "Flexible Inheritance for Class
Functions", that section makes perfect sense but it's not clear if there is any value to defining a function of the form classname_functionmame() if you're not going to export it with EXPORT_FUNCTIONS.

case in point -- cmake.bbclass. at bottom of file, we see some
perfectly reasonable exporting:

EXPORT_FUNCTIONS do_configure do_compile do_install do_generate_toolchain_file

but if you grep, there is an additional function being defined of that
form:

cmake_do_generate_toolchain_file() {
cmake_do_configure() {
cmake_runcmake_build() { <-- this one
cmake_do_compile() {
cmake_do_install() {

Quoted 3 lines

sure, that function is invoked internally in that class file, but without being exported, is there any reason that function has a "cmake_" prefix?

It makes it clear it comes from the cmake class? Namespacing is useful even if EXPORT_FUNCTIONS isn't involved.

Cheers,

Richard