[Gambas-devel] component
Ken Schrock
schrockk at ...26...
Sat Jun 7 21:18:32 CEST 2003
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?
(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;
}
}
static void hook_main(int *argc, char **argv)
{
/* main stuff */
}
Also, Gambas (IDE etc) work well here with this binary package
I therefore want to leave it alone and do this level dev elsewhere
I also have Mandrake version 8.2 on this machine
Will the 0.57 source compile ok there?
--
Using Lindows
More information about the Devel
mailing list