Thread: Don't understand part of the source... Help!

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    2

    Don't understand part of the source... Help!

    Hello, I'm new in this forum so I hope i'm within the rules :P

    Anyways... about the part of the code that I don't understand. It comes from gtkmozembed and many other open sourced ... source.


    They would define something like :
    Code:
    GTKMOZEMBED_API(void)   gtk_moz_embed_close_stream     (GtkMozEmbed *embed);
    and above it, they would have a macro:
    Code:
    #define  GTKMOZEMBED_API(type) type
    Now... I understand the macros...

    But... Where's the rest of the function??

    How does it know what to do if we type:
    Code:
    gtk_moz_embed_close_stream(*embeded_widget);

    I have scanned & used the search on all of the source files, and I can't seems to find a link for it...

    Another source file that I can relate to is the source of salamander:

    in main.h, there's a definition for a function
    Code:
    void create_menu(geckobrowser *mozzie);
    But I can't find the rest of the function, not in main.c, not in the included files, not in anything.

    Is it a type of overloading?

    if so, where's the original function?

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Judging by the name of the functions, they are probably part of the Gecko engine and GTK, two cross-platform libraries. The compiler (well, the linker) links to a pre-compiled library containing the code for those functions, probably with a command line like this:
    Code:
    $ g++ *.cpp -lgtk -lgecko
    If you want access to the source code for those functions, try downloading those libraries. If you just want to compile that program, figure out the command line you need. You may need to download the libraries anyway.

    To create a (static) library, one compiles (but doesn't link) a bunch of source files. Then you use the ar command to create a .a archive:
    Code:
    ar r libmylibrary.a *.o
    Then you can use that library with GCC or g++:
    Code:
    $ g++ *.cpp -L. -lmylibrary
    -L. adds the current directory to g++'s library search path.
    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. How to build, run Boland C++ 6 source file via VS2005?
    By userpingz in forum C++ Programming
    Replies: 2
    Last Post: 05-21-2009, 03:25 AM
  2. Debug into Source
    By lehe in forum C++ Programming
    Replies: 4
    Last Post: 02-18-2009, 10:45 AM
  3. Open Source Licenses
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 10-10-2006, 08:53 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM