[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] OC_GTK help
From: |
Brian Tiffin |
Subject: |
Re: [open-cobol-list] OC_GTK help |
Date: |
Mon, 6 Jul 2009 04:03:11 -0400 |
User-agent: |
KMail/1.9.9 |
Micheal,
You caught me out a little here. ;) It seems I've been using "outside
the API" features of some of the innards of the OpenCOBOL runtime, and
exactly as it should, changes to the compiler broke this example.
I'm not sure where you got your copy of the ocgtk.c, but I've posted a
version (that I used to genny the screenshots for the FAQ) with fixes (deemed
temporary, as I think there may be safer more "published" ways to get at the
OpenCOBOL global pointer than this quick hack) to
http://svn.wp0.org/ocdocs/brian/
the two files being
http://svn.wp0.org/ocdocs/brian/ocgtk.c
http://svn.wp0.org/ocdocs/brian/gtkhello.cob
and using tectonics of
cobc -c `pkg-config --cflags gtk+-2.0` ocgtk.c
cobc -x -W -debug `pkg-config --libs gtk+-2.0` gtkhello.cob ocgtk.o
Just so you know ... I've moved off this GTK in C wrapper project in favour of
the the much easier Vala wrappers. I've been meaning to add the sources to
the FAQ under the Vala section. Vala is a C-sharp syntax language that
generates C (just like OC), but is written specifically for Glib and GTK.
The embedded webkit browser sample using Vala and then linking the object
files to OpenCOBOL was a 5 minute job.
I should have some of the Vala sources orgranized for posting soon.
If you are keen to follow up on GTK in C, a few months back, someone on the
comp.lang.cobol usenet group was interested in this code sample and may have
done some nifty things in this area.
Cheers,
Brian
On July 6, 2009 01:22:33 am Michael wrote:
> Thanks David.
>
> cobc `pkg-config --cflags gtk+-2.0` ocgtk.c
>
> The above `cobc` resolved the gtk issues, now I have another problem.
>
> ocgtk.c: In function 'CBL_OC_GTK_WINDOW_SET_TITLE`:
> ocgtk.c:30: error: `cob_module` undeclared
> ocgtk.c:30: error: `module` undeclared
> ocgtk.c: In function 'CBL_OC_GTK_ENTRY_GET_TEXT`:
> ocgtk.c:107: error: `cob_module` undeclared
> ocgtk.c:107: error: `module` undeclared
>
> It seems that `cob_module` and `module` are in common.h of libcob, I
> actually look at it.
> I've added -I/usr/local/include/libcob to the above cobc, and still they
> are undeclared. Probably something simple. Assuming that c includes are
> similar to cobol `copy books` or `copy libraries`. In the old days when
> thought I might have a cobol `copy book` problem, I would just gather
> them directly into my source to eliminate the problem. I don't know
> enough about the c language to get around this problem.
>
> Looking at pkg-config, it looks like a great tool to help manage
> includes, and the like, but pkg-config --list-all reveals nothing for
> opencobol?
>
> Any help will be very much appreciated!
> Time for a good stiff drink!
>
> <Optionalreading>
> I've been using Linux for years, but only using it (network config,
> web/html , email, ftp, and stuff like that), no real programming.
> I've been writing Fortran, COBOL, and some C for decades in the
> mini-mainframe world, started with Fortran/66 in 1983, then ansi74 COBOL
> in 1986, very little C.
> OpenCobol is my path to multi platform programming. I really want to
> _thank everyone _evolved in developing OpenCobol.
> There are other areas I need to conquer in a multi-platform environment,
> GUI, DBMS, and System calls or intrinsics.
> However, right now I can't seem to compile anything worthwhile! When
> (not if) I get running with this, I'll be serious advocate for OpenCobol!
> </Optionalreading>
>
> Michael
> 832.515.3868
>
> David Essex wrote:
> > Michael wrote:
> >> I've been trying to make use of OpenCobol with GTK. I've compiled
> >> ocgtk.c, and ocgtkhtml.cob.
> >> i get the following errors:
> >> ocgtk.o:ocgtk.c:(.text+0x147): undefined reference to `_G_CALLBACK'
> >> ocgtk.o:ocgtk.c:(.text+0x154): undefined reference to `_G_OBJECT'
> >> ocgtk.o:ocgtk.c:(.text+0x170): undefined reference to
> >> `_g_signal_connect' ocgtk.o:ocgtk.c:(.text+0x194): undefined reference
> >> to
> >> `_gtk_type_check_object_cast'
> >>
> >> What am I missing?
> >>
> >> Platform cygwin on WinXP Pro.
> >>
> >> I've successfully compiled and executed the follow GTK "C" program: so I
> >> know I have GTK installed correctly:
> >
> > You are missing a library in your link step.
> > If available, use 'gtk-config --libs' or 'pkg-config --libs gtk+-2.0'
> > script to get all the libraries.
> >
> > Example on Linux:
> > #gtk-config --libs
> > -L/usr/lib -L/usr/X11R6/lib -lgtk \
> > -lgdk -rdynamic -lgmodule -lglib -ldl -lXext -lX11 -lm
> >
> > Or better still, create a native WinXP application using the Win32 API.
> > Hint, a COBOL (sub)program is equivalent to a C function.
> >
> > -------------------------------------------------------------------------
> >----- _______________________________________________
> > open-cobol-list mailing list
> > address@hidden
> > https://lists.sourceforge.net/lists/listinfo/open-cobol-list
>
> ---------------------------------------------------------------------------
>--- _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
- [open-cobol-list] OC_GTK help, Michael, 2009/07/04
- Re: [open-cobol-list] OC_GTK help, David Essex, 2009/07/04
- Re: [open-cobol-list] OC_GTK help, Michael, 2009/07/06
- Re: [open-cobol-list] OC_GTK help,
Brian Tiffin <=
- Re: [open-cobol-list] OC_GTK help, David Essex, 2009/07/06
- Re: [open-cobol-list] OC_GTK help, Michael, 2009/07/08
- Re: [open-cobol-list] OC_GTK help, Paul McNary, 2009/07/08
- Re: [open-cobol-list] OC_GTK help, Michael, 2009/07/08
- Re: [open-cobol-list] OC_GTK help, Paul McNary, 2009/07/08
- Re: [open-cobol-list] OC_GTK help, Paul McNary, 2009/07/08
- Re: [open-cobol-list] OC_GTK help, David Essex, 2009/07/08
- Message not available
- Re: [open-cobol-list] OC_GTK help, David Essex, 2009/07/09
- Re: [open-cobol-list] OC_GTK help, John Culleton, 2009/07/10
- Re: [open-cobol-list] OC_GTK help, David Essex, 2009/07/10