Code Monkey home page Code Monkey logo

Comments (6)

davidchappelle avatar davidchappelle commented on July 19, 2024

Ok I think I may have found the issue. It appears that the functions tagged with the __init specifier are not being invoked:

lib/route/addr.c
1129 static void __init addr_init(void)
1130 {
1131     nl_cache_mngt_register(&rtnl_addr_ops);
1132 }

from libnl.

davidchappelle avatar davidchappelle commented on July 19, 2024

Doesn't seem to matter what I do, I am not getting ant of these functions linked into my binary which means they are not getting executed on startup to setup the cache ops. How do I force this stuff to get linked in?

from libnl.

thom311 avatar thom311 commented on July 19, 2024

What is

$ test-cache-manager "route/addr"

? Is that something you wrote?

__init is defined as attribute((constructor)) (https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). This is a compiler specific extension. gcc and clang support that. Are you using another compiler?

from libnl.

davidchappelle avatar davidchappelle commented on July 19, 2024

test-cache-manager came from the tests directory in this repo (test-cache-mngr.c). Suppose I should have made that clearer. I figured out what the issue was. No symbols are referenced from lib/route/addr.c or route/link.c so as a result addr_init and link_init were not included and thus not invoked. Not sure if the intent of that test is to actually do anything useful though. I was trying to use it as a starting point for using the cache manager.

from libnl.

thom311 avatar thom311 commented on July 19, 2024

test-cache-mngr links dynamically to the libnl libraries:
$ libtool --mode=execute ldd ./tests/test-cache-mngr
so, I don't see any reason why addr_init() shouldn't be called.

How did you build test-cache-mngr? Usually you would just type make check.

the test functions are unfortunately not unit-test-like test programs that can always run and test something sensible (would be great to have, patches welcome). They are rather some hacked up snippets to demo something and to test it (manually) while implementing it.

Yeah, they should be better... but test-cache-mngr works as expected for me (including calling init_addr()).

from libnl.

davidchappelle avatar davidchappelle commented on July 19, 2024

I guess I am statically linking so that would explain why.

from libnl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.