[Gambas-devel] component

Benoit Minisini gambas at ...20...
Mon Jun 9 09:54:40 CEST 2003


Le Dimanche 8 Juin 2003 23:01, Ken Schrock a écrit :
> Benoit Minisini wrote:
> >Le Samedi 7 Juin 2003 21:18, Ken Schrock a écrit :
> >>Let's see if I have this right
> >>Would this yield a component called 2Example
> >>With a single read-only property called width, type integer?
> >
> >Yes.
>
> Ok, then when this compiles
> I should have lib.gb.2example.so.0.0.0
> Which goes into /usr/gambas/lib along with
> Links .so and .so.0 to it, and a lib.gb.2example.la

Yes. Provided that there is a correct Makefile.am in the component source 
directory, and that I modify the configure.in file.

> Plus an ini type section for it in /usr/gambas/component

This must be added by hand.

>
> Pretty well cover it?
>
> >>(which would always return 0 at this point : -)
> >>HACK Hack hack Minimalist version
> >>
> >>/********************* short_c2example.h **********************/
> >>
> >>#ifndef __C2EXAMPLE_H
> >>#define __C2EXAMPLE_H
> >>
> >>#include "gambas.h"
> >>
> >>#ifndef __C2EXAMPLE_C
> >>
> >>extern GB_DESC CExampleDesc[];
> >>
> >>#else
> >>
> >>#define THIS ((C2EXAMPLE *)_object)
> >>
> >>#endif
> >>
> >>typedef
> >>  struct {
> >>    GB_BASE ob;
> >>    long width;
> >>    }
> >>  C2EXAMPLE;
> >>
> >>#endif
> >>
> >>/****************** short_c2example.c ****************/
> >>
> >>#define __C2EXAMPLE_C
> >>
> >>#include "short_main.h"
> >>#include "Short_C2Example.h"
> >>
> >>
> >>BEGIN_PROPERTY(C2EXAMPLE_width)
> >>
> >>  GB.ReturnInteger(THIS->width);
> >>
> >>END_PROPERTY
> >>
> >>
> >>GB_DESC C2ExampleDesc[] =
> >>
> >>  GB_DECLARE("2Example", sizeof(C2EXAMPLE)),
> >>
> >>  GB_PROPERTY_READ("Width", "i", C2EXAMPLE_width),
> >>
> >>  GB_END_DECLARE
> >>};
> >>
> >>/************* short_main.h *****************/
> >>
> >>#ifndef __MAIN_H
> >>#define __MAIN_H
> >>
> >>#include "gambas.h"
> >>
> >>#ifndef __MAIN_C
> >>
> >>extern GB_INTERFACE GB;
> >>
> >>#else
> >>
> >>static void hook_main(int *argc, char **argv);
> >>
> >>#endif /* __MAIN_C */
> >>
> >>#endif /* __MAIN_H */
> >>
> >>/****************** short_main.c *********************/
> >>
> >>#define __MAIN_C
> >>
> >>#include "Short_C2Example.h"
> >>#include "short_main.h"
> >>
> >>GB_INTERFACE GB;
> >>
> >>GB_DESC *GB_CLASSES[] =
> >>{
> >>  C2ExampleDesc,
> >>  NULL
> >>};
> >>
> >>int GB_INIT(void)
> >>{
> >>  GB.Hook(GB_HOOK_MAIN, (void *)hook_main);
> >>  return 0;
> >>}
> >>
> >>void GB_EXIT()
> >>{
> >>}
> >>
> >>void GB_INFO(int info, void **result)
> >>{
> >>  switch (info)
> >>  {
> >>    case GB_INFO_CONTROL:
> >>      *result = (void *)NULL;
> >>      break;
> >>
> >>    case GB_INFO_REQUIRE:
> >>      *result = (void *)NULL;
> >>      break;
> >>  }
> >>}
> >
> >It is not necessary to manage the cases where GB_INFO returns NULL,
> > because this is the default value.
> >
> >>static void hook_main(int *argc, char **argv)
> >>{
> >>/* main stuff */
> >>}

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the Devel mailing list