[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] do I need separate libfiles for every module?
From: |
Martin Kalbfuß |
Subject: |
Re: [Gm2] do I need separate libfiles for every module? |
Date: |
Wed, 06 Jan 2010 14:32:31 +0100 |
Hi,
To allow this would be helpful. The problem is the compatibility with
existing tools. Build systems like Autotools, CMake and Scons don't
know the way gm2 handle libraries.
So this doesn't happen with "C" modules? Can I have init and finish
sections with a "C" definition module? If so, this problem disappears.
This would be even cleaner.
Another compatibility problem is the fact that the linking step needs
the mod file names instead of the object file names. Would it be
possible to allow both to be passed?
Thanks
Am Mittwoch, den 06.01.2010, 12:06 +0000 schrieb Gaius Mulley:
> Martin Kalbfuß <address@hidden> writes:
>
> > Hi,
> >
> > I have the following lines:
> >
> > gm2 -c test.mod -I../def
> > gm2 test.mod -L../src/.libs -lsk -lSDL
> >
> > The first line works like I would expect it.
> > But the second line does not.
> >
> > gm2 says:
> >
> > cannot find SKVideo.o or SKVideo.a
>
> Hi Martin,
>
> > This is an imported module.
>
> a normal Modula-2 module (not a DEFINITION MODULE FOR "C").
>
> > He cannot find them because there are no such files. SKVideo.o is part
> > of libsk.a
> >
> > Why does the linking step need an object file with the same name as the
> > module?
>
> it currently builds a list of objects which it passes to gcc for the
> final link.
>
> > When I work with C and gcc, it's completely up to me where the code is,
> > as long as I link it
>
> ok. Sure this is true - gm2 could be altered to work in the same way.
> Perhaps it should check for .o files first of all and if they do not
> exist continue by looking for .a files and lastly add in the -llibs
> and pass the whole collection to gcc for the link. We would get
> slightly less helpful error messages at link time if it fails but it
> would match the gcc behaviour.
>
> > I would do
> >
> > gcc -c test.c -I../include
> > gcc -o test test.o -L../src/.libs -lsk -lSDL
> >
> > or I could do
> >
> > gcc -o test test.o SKVideo.o -lSDL
> >
> > With gm2, only the second variant works. Is there a reason for this?
> > I find this behaviour more confusing hen helpfull. If he can't find the
> > referenced functions in the symbol table he tells me anyway with an
> > undefined reference error.
>
> true - it can be altered to match this behaviour.. The main point of
> difference is that gm2 will build the list of objects necessary for
> linking from the module imports. But it could be altered so that it
> does not insist on these being present
>
> regards,
> Gaius