Using iproute2 existing code for my application

This is a discussion on Using iproute2 existing code for my application within the C Programming forums, part of the General Programming Boards category; Hi, i would like to use the iproute2 packet in my application avoiding the use of system(const char*) calls to ...

  1. #1
    kky
    kky is offline
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Using iproute2 existing code for my application

    Hi, i would like to use the iproute2 packet in my application avoiding the use of system(const char*) calls to perform commands, so my first approach was to create a library.a from the iproute2 packet and then call the main function (of iproute2) in my code. Is there a nicer approach? i would like also to avoid rewriting the same code, i was wondering also if the use of iproute2 application as library could create some problems, see global function that in my case wont be reset.

    i have the same dout with Netfilter (iptables), what is usually the way of doing things ?
    thank you!
    kky

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    If you want to actually execute a separate program such as iproute2, then there are really only two ways to go about it that I can think of at the moment. Use system() or a similar command to execute the program in executable form; or do as you have done and incorporate the program's code into your own.

    It's different, of course, if the program is just a wrapper around a library, like bzip2 is. But iproute does not seem to be this way, so I guess you've identified the only two solutions.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Choosing a compiler
    By pushingsquares in forum Game Programming
    Replies: 27
    Last Post: 12-14-2006, 10:33 AM
  2. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 01:48 AM
  3. Replies: 1
    Last Post: 03-21-2006, 07:52 AM
  4. Replies: 4
    Last Post: 01-16-2002, 12:04 AM
  5. A send mail application with source code
    By Rizwan Rafique in forum Windows Programming
    Replies: 8
    Last Post: 01-11-2002, 10:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21