RSS/Atom feed Twitter
Site is read-only, email is disabled

Parasite questions

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

Parasite questions Eric Grivel 13 Mar 13:39
  Parasite questions Bill Skaggs 13 Mar 16:24
   Parasite questions Bill Skaggs 13 Mar 16:37
   Parasite questions Eric Grivel 14 Mar 11:49
    Parasite questions Bill Skaggs 14 Mar 17:17
     Parasite questions Eric Grivel 14 Mar 23:06
Eric Grivel
2011-03-13 13:39:33 UTC (about 13 years ago)

Parasite questions

Hi,

I'm running into compile errors when I'm adding a function to tools/pdbgen/pdb/image.pdb:

undefined reference to 'gimp_image_detach_parasite' undefined reference to 'gimp_image_get_parasite_list' undefined reference to 'gimp_image_get_parasite'

Delving deeper into this, I'm finding two function: - gimp_image_parasite_list()
- gimp_image_get_parasite_list()

According to a comment in libgimp/gimpimage.c, the version without the "get" in the name is deprecated and the one with the "get" should be used instead. The version without "get" is implemented here by calling the one with "get". However, in tools/pdbgen/pdb/image.pdb, the version with "get" is implemented by calling the one without "get". This seems a bit circular to me.

Something seems to be strange with the parasite functions... everything compiles fine when I get the source straight from git, but starts to break when I add functions to image.pdb.

So my question is: am I doing something wrong by adding functions to image.pdb, or is there actually something wrong with the parasite functions?

The changes I'm making to image.pdb are: - mark image_get_filename deprecated - mark image_set_filename deprecated - change description of image_get_uri - add image_set_uri
- add image_get_imported_uri
- add image_get_exported_uri

The error output when compiling:

make[4]: Entering directory `/mnt/lincoln/d3/gimp/source/gimp/plug-ins/script-fu' CC script-fu.o
CC script-fu-console.o
CC script-fu-eval.o
CC script-fu-interface.o
CC script-fu-text-console.o
CC script-fu-script.o
CC script-fu-scripts.o
CC script-fu-server.o
CC scheme-wrapper.o
CCLD script-fu
/mnt/lincoln/d3/gimp/source/gimp/libgimp/.libs/libgimp-2.0.so: undefined reference to `gimp_image_detach_parasite' /mnt/lincoln/d3/gimp/source/gimp/libgimp/.libs/libgimp-2.0.so: undefined reference to `gimp_image_get_parasite_list' /mnt/lincoln/d3/gimp/source/gimp/libgimp/.libs/libgimp-2.0.so: undefined reference to `gimp_image_get_parasite' collect2: ld returned 1 exit status
make[4]: *** [script-fu] Error 1
make[4]: Leaving directory
`/mnt/lincoln/d3/gimp/source/gimp/plug-ins/script-fu'

Eric

Bill Skaggs
2011-03-13 16:24:14 UTC (about 13 years ago)

Parasite questions

Pdbgen is part of the gimp application core. Libgimp is an interface library designed to
be used by plug-ins -- it is not and cannot be used inside the core. The functions that
can be used inside the core are documented at http://developer.gimp.org/api/2.0/app/index.html . In many cases they correspond pretty closely to libgimp functions, but the function names
are sometimes different, and the arguments are almost always different.

-- Bill

Bill Skaggs
2011-03-13 16:37:09 UTC (about 13 years ago)

Parasite questions

Um, let me say that a little more precisely. Pdbgen itself is not part of the core, but the C code
it generates to implement its functions goes into app/pdb in the source code tree, which is part of
the core and can only use functions that are accessible in the core.

-- Bill

Eric Grivel
2011-03-14 11:49:53 UTC (about 13 years ago)

Parasite questions

Thanks, Bill. That makes sense. Let's see if I understand this correctly:

app/core/gimpimage.c defines the function gimp_image_parasite_list, which actually implements the functionality of getting a list of parasites.

libgimp/gimpimage.c also defines a function called gimp_image_parasite_list, which tries to retrieve a list of parasites; this is what should be used by the plugins. However, this function tries to call a function called gimp_image_get_parasite_list, which doesn't exist. Hence the "undefined references" I'm getting.

tools/pdbgen/pdb/image.pdb defines a function called gimp_image_get_parasite_list, which calls the function gimp_image_parasite_list. I assume this is supposed to reference the version in app/core/gimpimage.c

The thing I don't understand is how this can possibly compile at all? I'm only getting the errors if I add functions to image.pdb. If I leave image.pdb as it comes from git, everything compiles.

The other thing I'm not sure about is whether the code I described above can even work. Can there be functions with the same name defined in app/core, in libgimp, and in pdb?

Thanks, Eric

On 03/13/2011 12:24 PM, Bill Skaggs wrote:

Pdbgen is part of the gimp application core. Libgimp is an interface library designed to
be used by plug-ins -- it is not and cannot be used inside the core. The functions that
can be used inside the core are documented at http://developer.gimp.org/api/2.0/app/index.html . In many cases they correspond pretty closely to libgimp functions, but the function names
are sometimes different, and the arguments are almost always different.

-- Bill

Bill Skaggs
2011-03-14 17:17:14 UTC (about 13 years ago)

Parasite questions

It compiles because Gimp plug-ins (unlike PhotoShop plug-ins) are separate executables, which
communicate with the main Gimp app via a shared memory channel.  As separate executables,
they are compiled separately and don't necessarily need to avoid function namespace conflicts with
the main app.  (Although in my opinion it would be better design to avoid such conflicts.)

The libgimp function gimp_image_get_parasite_list is actually just the C hook for the function
image_get_parasite_list_invoker, whose autogenerated source code you can find in app/pdb/image_cmds.c. The PDB actually consists of a large set of "invoker" functions
of that sort -- libgimp is simply the C language binding that C plug-ins use to access the
PDB. Other languages such as Python and Ruby have their own bindings -- the function of
a binding is to transform a native language command into a call to one of the invoker functions
that belong to the PDB.

(Libgimp also contains some utility functions that are useful for C plug-ins but don't involve
the PDB, but that doesn't affect the main point.)

-- Bill

Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Eric Grivel
2011-03-14 23:06:07 UTC (about 13 years ago)

Parasite questions

Thanks, Bill. I finally figured it out. At the bottom of tools/pdbgen/pdb/image.pdb, a hard-coded subset of the @proc array is passed as the series of functions to add to the library. By adding new functions, the bottom ones were no longer included, and so resulted in unresolved references.

I will include a couple of lines of comments that explain what is going on in the patch I will be submitting. I should also submit a patch for the README_NEW_PDB_PROC document to include this information in the documentation...

Eric

On 03/14/2011 01:17 PM, Bill Skaggs wrote:

It compiles because Gimp plug-ins (unlike PhotoShop plug-ins) are separate executables, which
communicate with the main Gimp app via a shared memory channel. As separate executables,
they are compiled separately and don't necessarily need to avoid function namespace conflicts with
the main app. (Although in my opinion it would be better design to avoid such conflicts.)

The libgimp function gimp_image_get_parasite_list is actually just the C hook for the function
image_get_parasite_list_invoker, whose autogenerated source code you can find in app/pdb/image_cmds.c. The PDB actually consists of a large set of "invoker" functions
of that sort -- libgimp is simply the C language binding that C plug-ins use to access the
PDB. Other languages such as Python and Ruby have their own bindings -- the function of
a binding is to transform a native language command into a call to one of the invoker functions
that belong to the PDB.

(Libgimp also contains some utility functions that are useful for C plug-ins but don't involve
the PDB, but that doesn't affect the main point.)

-- Bill