Re: modules cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Nov 1999 19:25:56 +0200 (FLE Standard Time), Tor Lillqvist wrote:

> > The OS/2 and UNIX code is doing the same !
> > The structure PLUG_IN_INFO is a REAL input and should be a parameter
> > input to gimp_main().    ex:  gimp_main(argc,argv, &PLUG_IN_INFO);
> >
> > On UNIX they trust/use fork() to input the structure, but my OS/2
> > version will work on all system with or without forking.
>
>Sorry, I don't follow you here, I don't see any forking going on. To
>my understanding, PLUG_IN_INFO is (on Unix) a (data) entry point
>(i.e. a externally visible variable) in the plug-in executable, and
>the libgimp shared library references it. The problem with
>PLUG_IN_INFO on OS/2 apparently is that it's hard on OS/2 to refer to
>exported variables in the executable that has loaded a shared library
>from the library.

The UNIX do a fork() to start the plug-ins so i tough that it's was inherited with the
GIMP's->main->libgimp->PLUG_IN_INFO.
Well it was a long time so maybe i misunderstand the INPUT flow.
That's the real problem here. A simple input (PLUG_IN_INFO) is inputted at linking time and not
at run time. I don't wanna know different linker methods to do a simple input to libgimp.

A new programmer will waste a lot of time to rediscover this hidden input.
If the PLUG_IN_INFO have been inputted with parameters in the first place nobody have
been discussing this issue.

Here is my OS/2 patch to do what the UNIX,, linkers do  :
Very simple and work on all systems !   :)

void set_gimp_PLUG_IN_INFO (const GPlugInInfo *p)
{
  PLUG_IN_INFO = *p;
}

main (int argc, char *argv[])
{
     set_gimp_PLUG_IN_INFO(&PLUG_IN_INFO);
     return gimp_main (argc, argv);
}

Every programmer understand what's going on but they will
ask
  Why call set_gimp_PLUG_IN_INFO() before gimp_main() ?

I would tell them "It's because gimp_main use PLUG_IN_INFO!".
And so on....


The final solution will be for all OS'es:

main (int argc, char *argv[])
{
      return gimp_main (argc, argv, &PLUG_IN_INFO);
}

Simple, readable ,understandable and NO linking problems.


>
>Although on Win32 you could look up the PLUG_IN_INFO address in the
>plug-in executable from the DLL (as long as it is marked for export),
>I do it almost like OS/2: I pass the address of PLUG_IN_INFO to a
>function in libgimp, that stores it in a place easily accessible to
>libgimp. (On OS/2, you store a copy of PLUG_IN_INFO in libgimp, while
>on Win32 I only store a pointer.)
>
>I agree with you, the "pass PLUG_IN_INFO address as parameter from the
>plug-in to gimp_main in libgimp" approach could well be used for all
>platforms, it would clean up the ifdefs in gimp.c and gimp.h quite a
>bit.
>
>--tml
***********************************************************
* Asbjørn Pettersen           Phone work: +47 77 66 08 91  *
* Kongsberg Spacetec a.s     Phone home: +47 77674022  *
*                              Telefax:    +47 77 65 58 59  *
* Prestvannveien 38          www:http://www.spacetec.no   *
* N-9005 Tromsoe, Norway     email:ape@xxxxxxxxxxx  *
***********************************************************



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux