Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-08

Re: Graphics cards, VGALIB

39 messages · 11 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Florian Klaempfl
to Jeff Weeks: Do I really need to use vgalib under linux? I'm having a hard time finding a supported…
Jeff Weeks wrote
Do I really need to use vgalib under linux?

It depends what you want to do?

Show quoted text 24 lines
I'm having a hard time finding a supported graphics card. Is it true that only a handful of chipsets are supported? Any way to use the X graphics rather than vgalib? Can't get graphics to work on my Trident 9660. It's the oldest chipset I have. I'm looking on Ebay for a replacement. Is this it? * VGA * EGA * ARK Logic ARK1000PV/2000PV * ATI VGA Wonder * ATI Mach32 * Cirrus 542x, 543x * OAK OTI-037/67/77/87 * S3 (limited support) * Trident TVGA8900/9000 * Tseng ET3000/ET4000/W32 _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jeff Weeks

Do I really need to use vgalib under linux? I'm having a hard time finding a supported graphics card. Is it true that only a handful of chipsets are supported? Any way to use the X graphics rather than vgalib?

Can't get graphics to work on my Trident 9660. It's the oldest chipset I have. I'm looking on Ebay for a replacement.

Is this it?

* VGA
* EGA
* ARK Logic ARK1000PV/2000PV
* ATI VGA Wonder
* ATI Mach32
* Cirrus 542x, 543x
* OAK OTI-037/67/77/87
* S3 (limited support)
* Trident TVGA8900/9000
* Tseng ET3000/ET4000/W32

Jeff Weeks
to Michael Knapp: use svgalib instead. Michael

Actually, that list was indeed for svgalib and I'm using svgalib.

The files are still named libvga.config, etc, but hey are svga.

Jeff

Michael Knapp wrote 16 lines
Jeff Weeks wrote: > Do I really need to use vgalib under linux? I'm having a hard time > finding a supported graphics card. Is it true that only a handful of > chipsets are supported? Any way to use the X graphics rather than > vgalib? use svgalib instead. Michael _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jeff Weeks
to Florian Klaempfl: It depends what you want to do?

I need to use graphics mode. Text works fine but I need to do some graphing, etc.

Jeff

Florian Klaempfl wrote 30 lines
Jeff Weeks wrote: > Do I really need to use vgalib under linux? It depends what you want to do? > I'm having a hard time finding a supported graphics card. Is it true > that only a handful of chipsets are supported? Any way to use the X > graphics rather than vgalib? > Can't get graphics to work on my Trident 9660. It's the oldest > chipset I have. I'm looking on Ebay for a replacement. > Is this it? > * VGA > * EGA > * ARK Logic ARK1000PV/2000PV > * ATI VGA Wonder > * ATI Mach32 > * Cirrus 542x, 543x > * OAK OTI-037/67/77/87 > * S3 (limited support) > * Trident TVGA8900/9000 > * Tseng ET3000/ET4000/W32 > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jeff Weeks
to Jeff Weeks: Actually, that list was indeed for svgalib and I'm using svgalib. The files are still…

I realized I'm using an older version of SVGALIB.

1.4.3 adds a few important chipsets.

Jeff

Jeff Weeks wrote 29 lines
Actually, that list was indeed for svgalib and I'm using svgalib. The files are still named libvga.config, etc, but hey are svga. Jeff On Aug 26, 2004, at 11:46 AM, Michael Knapp wrote: > Jeff Weeks wrote: > >> Do I really need to use vgalib under linux? I'm having a hard time >> finding a supported graphics card. Is it true that only a handful >> of chipsets are supported? Any way to use the X graphics rather >> than vgalib? > > > use svgalib instead. > > Michael > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Jeff Weeks
to Marco van de Voort: Yes, look for the SDL headers (Jedi-SDL), or use plain OpenGL.

I tried the SDL4Freepascal headers and they seem to work. Just can't see how to display text. And they don't appear to work on Macintosh. JEDI-SDL supposedly works on a "modified" version of Freepascal on a Mac.

Any Mac people out there using JEDI-SDL? Anyone have Freepascal examples?

Thanks.

Jeff

Marco van de Voort wrote 11 lines
> Do I really need to use vgalib under linux? I'm having a hard time > finding a supported graphics card. Is it true that only a handful of > chipsets are supported? Any way to use the X graphics rather than > vgalib? Yes, look for the SDL headers (Jedi-SDL), or use plain OpenGL. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Marco van de Voort
to Jeff Weeks
Show quoted text 7 lines
I tried the SDL4Freepascal headers and they seem to work. Just can't see how to display text. And they don't appear to work on Macintosh. JEDI-SDL supposedly works on a "modified" version of Freepascal on a Mac. Any Mac people out there using JEDI-SDL? Anyone have Freepascal examples?

Not yet on a Mac, but I had most examples running on FreeBSD.

They are in cvs under projects/contrib/sdl

Jonas Maebe
to Jeff Weeks: I tried the SDL4Freepascal headers and they seem to work. Just can't see how to display…
Jeff Weeks wrote 7 lines
I tried the SDL4Freepascal headers and they seem to work. Just can't see how to display text. And they don't appear to work on Macintosh. JEDI-SDL supposedly works on a "modified" version of Freepascal on a Mac. Any Mac people out there using JEDI-SDL? Anyone have Freepascal examples?

The main problem is currently that you have to change the Darwin system unit, by renaming the "main" procedure in rtl/bsd/system.pp to "SDLMain" and then recompile the system unit. Of course, afterwards that system unit is only usable to create SDL programs.

So we have to implement a way to specify the name of the routine when compiling the program, but that means it must be moved to the main program and "generated" inside the compiler. Because it receives parameters, this is non trivial (unless I hardcode the parameter locations, but that's dirty and non-portable).

Jonas

Jeff Weeks
to Jeff Weeks: I tried the SDL4Freepascal headers and they seem to work. Just can't see how to display…

I'd like to try using JEDI-SDL but the directions only tell how to set up the IDE... not how to use the command line compiler under Linux.

I'm stumped on a few of them.

I condensed the following from the JEDI-SDL Yahoo Group instructions and added what I think the corresponding command-line switch should be:

Compiler switches page

Delphi 2 extensions to ON
Delphi compatibility to ON

-Mobjfpc
-Mdelphi

-------------------------------------------------
These I have no idea!!

Assembler Reader to Intel style Assembler
Assembler Output to precoff.

Add FPC to the conditional defines box at the bottom of the page.  
----------------------------

Options | Linker.

Preferred Library Type to Smart Libraries.

The closest thing I could find for this is:

-CX create also smartlinked library
-----------------------------

Options | Directories.

Unit directories box add path to where JEDI-SDL units exist.

USE -Fi

Thomas Schatzl
to Jeff Weeks

Hello,

Show quoted text 15 lines
I'd like to try using JEDI-SDL but the directions only tell how to set up the IDE... not how to use the command line compiler under Linux. I'm stumped on a few of them. I condensed the following from the JEDI-SDL Yahoo Group instructions and added what I think the corresponding command-line switch should be: Compiler switches page Delphi 2 extensions to ON Delphi compatibility to ON -Mobjfpc -Mdelphi

-Mobjfpc and -Mdelphi are different things and mutually exclusive (when given as compiler switch).

I guess that -Mdelphi is appropriate.

Show quoted text 5 lines
------------------------------------------------- These I have no idea!! Assembler Reader to Intel style Assembler

-Rintel

Assembler Output to precoff.

Probably this means pecoff, not precoff:

-Apecoff

Don't think that this compiler switch is required in this case. It just controls the output format - In this case generates win32 pe coff files, which is probably not suitable for a Linux environment.

Add FPC to the conditional defines box at the bottom of the page.

-dFPC

Show quoted text 8 lines
Options | Linker. Preferred Library Type to Smart Libraries. The closest thing I could find for this is: -CX create also smartlinked library

Should be correct.

Show quoted text 8 lines
----------------------------- Options | Directories. Unit directories box add path to where JEDI-SDL units exist. USE -Fi

Yes.

Regards,
Thomas

Marco van de Voort
to Thomas Schatzl
Show quoted text 20 lines
> I'd like to try using JEDI-SDL but the directions only tell how to set > up the IDE... not how to use the command line compiler under Linux. > > I'm stumped on a few of them. > > I condensed the following from the JEDI-SDL Yahoo Group instructions and > added what I think the corresponding command-line switch should be: > > Compiler switches page > > Delphi 2 extensions to ON > Delphi compatibility to ON > > -Mobjfpc > -Mdelphi -Mobjfpc and -Mdelphi are different things and mutually exclusive (when given as compiler switch). I guess that -Mdelphi is appropriate.

-MDelphi nowadays auto turns on -Rintel too

Show quoted text 6 lines
controls the output format - In this case generates win32 pe coff files, which is probably not suitable for a Linux environment. > Add FPC to the conditional defines box at the bottom of the page. -dFPC

FPC already defines FPC as internal symbol.

Florian Klaempfl
to Jonas Maebe: The main problem is currently that you have to change the Darwin system unit, by renaming…
Jonas Maebe wrote 22 lines
On 1 sep 2004, at 00:13, Jeff Weeks wrote: > I tried the SDL4Freepascal headers and they seem to work. Just can't > see how to display text. And they don't appear to work on Macintosh. > JEDI-SDL supposedly works on a "modified" version of Freepascal on a Mac. > > Any Mac people out there using JEDI-SDL? Anyone have Freepascal > examples? The main problem is currently that you have to change the Darwin system unit, by renaming the "main" procedure in rtl/bsd/system.pp to "SDLMain" and then recompile the system unit. Of course, afterwards that system unit is only usable to create SDL programs. So we have to implement a way to specify the name of the routine when compiling the program, but that means it must be moved to the main program and "generated" inside the compiler. Because it receives parameters, this is non trivial (unless I hardcode the parameter locations, but that's dirty and non-portable).

Can't you add the SDLMain to the darwin sdl units and let this call main? Or is main defined twice then because the sdllib contains a main?

Jonas Maebe
to Florian Klaempfl
Florian Klaempfl wrote
Can't you add the SDLMain to the darwin sdl units and let this call main? Or is main defined twice then because the sdllib contains a main?

Yes. And for some reason, the linker picks the main of our system unit to execute instead of the one in libsdl. I don't know on what basis it does this. The reason it doesn't trigger a duplicate symbol error is that the Mac OS X linker works with a two-level name space: all libraries have their own symbol namespace (although you can disable this for legacy *nix compatibility using an environment variable).

Jonas

Olle Raab
to Jonas Maebe

04-09-03 13.12, skrev Jonas Maebe följande:

Show quoted text 13 lines
On 3 sep 2004, at 11:16, Florian Klaempfl wrote: > Can't you add the SDLMain to the darwin sdl units and let this call > main? Or is main defined twice > then because the sdllib contains a main? Yes. And for some reason, the linker picks the main of our system unit to execute instead of the one in libsdl. I don't know on what basis it does this. The reason it doesn't trigger a duplicate symbol error is that the Mac OS X linker works with a two-level name space: all libraries have their own symbol namespace (although you can disable this for legacy *nix compatibility using an environment variable).

Can it help by changing the link order ? Or it is not possible wiht a 2 level ns.. ?

Olle

Jonas Maebe
to Olle Raab
Olle Raab wrote 9 lines
> Yes. And for some reason, the linker picks the main of our system unit > to execute instead of the one in libsdl. I don't know on what basis it > does this. The reason it doesn't trigger a duplicate symbol error is > that the Mac OS X linker works with a two-level name space: all > libraries have their own symbol namespace (although you can disable > this for legacy *nix compatibility using an environment variable). Can it help by changing the link order ? Or it is not possible wiht a 2 level ns.. ?

Hmm, yes, that's probably it. The two-level namespace is the reason that the order of the libraries and objects on the command line matters under Darwin... We'd have to introduce some compiler switches to influence the order in which the compiler passes the objects and libraries to the linker then though.

Jonas

Marco van de Voort
to Jonas Maebe
Show quoted text 12 lines
On 3 sep 2004, at 14:33, Olle Raab wrote: >> this for legacy *nix compatibility using an environment variable). > > Can it help by changing the link order ? Or it is not possible wiht a 2 > level ns.. ? Hmm, yes, that's probably it. The two-level namespace is the reason that the order of the libraries and objects on the command line matters under Darwin... We'd have to introduce some compiler switches to influence the order in which the compiler passes the objects and libraries to the linker then though.

We need this afaik for gtk2 too.

I was thinking about a simple global file with libnames and weights, with a possibility to override on the commandline.

Simple, generic, and configurable.

Jonas Maebe
to Marco van de Voort
Marco van de Voort wrote 8 lines
> Hmm, yes, that's probably it. The two-level namespace is the reason > that the order of the libraries and objects on the command line > matters > under Darwin... We'd have to introduce some compiler switches to > influence the order in which the compiler passes the objects and > libraries to the linker then though. We need this afaik for gtk2 too.

No, "gtk-config --libs" (or maybe "gtk2-config --libs" for gtk2?) tells you. In fact, there is also "sdl-config --libs", but of course it doesn't know anything about our system unit and main-troubles.

Or do you mean that gtk2 uses the same ugly hack of renaming the main procedure?

Jonas

Tomas Hajny
to Marco van de Voort: We need this afaik for gtk2 too. I was thinking about a simple global file with libnames…

On Fri, 3 Sep 2004 15:27:43 +0200 (CEST), Marco van de Voort wrote

Show quoted text 19 lines
> On 3 sep 2004, at 14:33, Olle Raab wrote: > >> this for legacy *nix compatibility using an environment variable). > > > > Can it help by changing the link order ? Or it is not possible wiht a 2 > > level ns.. ? > > Hmm, yes, that's probably it. The two-level namespace is the reason > that the order of the libraries and objects on the command line matters > under Darwin... We'd have to introduce some compiler switches to > influence the order in which the compiler passes the objects and > libraries to the linker then though. We need this afaik for gtk2 too. I was thinking about a simple global file with libnames and weights, with a possibility to override on the commandline. Simple, generic, and configurable.

This doesn't look very transparent to me (another place for configuration maintenance). What about optional parameter for $LINKLIB or something like that?

Tomas

Olle Raab
to Marco van de Voort: We need this afaik for gtk2 too. I was thinking about a simple global file with libnames…

04-09-03 15.27, skrev Marco van de Voort följande:

Show quoted text 19 lines
> On 3 sep 2004, at 14:33, Olle Raab wrote: >>> this for legacy *nix compatibility using an environment variable). >> >> Can it help by changing the link order ? Or it is not possible wiht a 2 >> level ns.. ? > > Hmm, yes, that's probably it. The two-level namespace is the reason > that the order of the libraries and objects on the command line matters > under Darwin... We'd have to introduce some compiler switches to > influence the order in which the compiler passes the objects and > libraries to the linker then though. We need this afaik for gtk2 too. I was thinking about a simple global file with libnames and weights, with a possibility to override on the commandline. Simple, generic, and configurable.

Macpas apps also has 2 'main', so the link order matters. I have hardcoded it so it always is correct.

Both Metrowerks and Think Pascal also has the ability to control link order, by drag and drop in a list...

Olle

Marco van de Voort
to Tomas Hajny: On Fri, 3 Sep 2004 15:27:43 +0200 (CEST), Marco van de Voort wrote This doesn't look very…
Show quoted text 8 lines
On Fri, 3 Sep 2004 15:27:43 +0200 (CEST), Marco van de Voort wrote > I was thinking about a simple global file with libnames and weights, > with a possibility to override on the commandline. > > Simple, generic, and configurable. This doesn't look very transparent to me (another place for configuration maintenance)

True. By design though, more importantly, it is systemwide, and can be part of the release (no editing at all for "known" packages and updated as one single file.

What about optional parameter for $LINKLIB or something like that?
{$linklib }  can happen multiple times for the same lib in different units.
Marco van de Voort
to Olle Raab: 04-09-03 15.27, skrev Marco van de Voort följande: Macpas apps also has 2 'main', so the…
Show quoted text 10 lines
04-09-03 15.27, skrev Marco van de Voort f?ljande: > a possibility to override on the commandline. > > Simple, generic, and configurable. Macpas apps also has 2 'main', so the link order matters. I have hardcoded it so it always is correct. Both Metrowerks and Think Pascal also has the ability to control link order, by drag and drop in a list...

That is still manual, and will provoke a lot of msgs and questions about how this is done.

A gtk2 app probably easily will have 10+ libs.

Florian Klaempfl
to Marco van de Voort: True. By design though, more importantly, it is systemwide, and can be part of the…
Marco van de Voort wrote 20 lines
>On Fri, 3 Sep 2004 15:27:43 +0200 (CEST), Marco van de Voort wrote > >>I was thinking about a simple global file with libnames and weights, >>with a possibility to override on the commandline. >> >>Simple, generic, and configurable. > >This doesn't look very transparent to me (another place for configuration >maintenance) True. By design though, more importantly, it is systemwide, and can be part of the release (no editing at all for "known" packages and updated as one single file. >What about optional parameter for $LINKLIB or something like that? {$linklib } can happen multiple times for the same lib in different units.

What about adding a priority parameter: 100 default, 0 low, 200 high; if there are multiple linklib entries, the highest value is used.

Marco van de Voort
to Florian Klaempfl
Show quoted text 11 lines
Marco van de Voort wrote: > single file. > > >>What about optional parameter for $LINKLIB or something like that? > > > {$linklib } can happen multiple times for the same lib in different units. What about adding a priority parameter: 100 default, 0 low, 200 high; if there are multiple linklib entries, the highest value is used.

The main problem is that it requires recompiling of the release in case of changes in order that conflicts somehow.

Instead of a separate file, we could add it as keyword to fpc.cfg, since fpc.cfg can be overriden.

#libpriority gtk2 100

Jonas Maebe
to Marco van de Voort: That is still manual, and will provoke a lot of msgs and questions about how this is done.
Marco van de Voort wrote 5 lines
That is still manual, and will provoke a lot of msgs and questions about how this is done. A gtk2 app probably easily will have 10+ libs.

The correct order and which libs you need can vary from OS to OS and maybe even from gtk2 release to release. There is no other way to really do it correctly than to rely on things like gtk-config.

Jonas

Marco van de Voort
to Jonas Maebe
Show quoted text 11 lines
On 3 sep 2004, at 16:16, Marco van de Voort wrote: > That is still manual, and will provoke a lot of msgs and questions > about > how this is done. > > A gtk2 app probably easily will have 10+ libs. The correct order and which libs you need can vary from OS to OS and maybe even from gtk2 release to release. There is no other way to really do it correctly than to rely on things like gtk-config.

Setup could run gtk-config and stuff it in the files. Then at least we keep the compiler free from such patchwork, and center the "ugliness" in the weights file that can be operated on by the user, external tools etc.

Jonas Maebe
to Marco van de Voort
Marco van de Voort wrote 5 lines
Setup could run gtk-config and stuff it in the files. Then at least we keep the compiler free from such patchwork, and center the "ugliness" in the weights file that can be operated on by the user, external tools etc.

Until someone upgrades his libraries and the next compile will be broken again. You have to work with makefiles to get around this. It has nothing to do with ugliness or patchwork on the compiler or language side imo, it's simply the way unix-type systems work and you have to deal with it one way or another.

The C-style building by default is simply more flexible in this regard, because the compiler is dumber and you can do whatever you want in the makefiles. If the compiler largely takes over make's job and you don't want to deviate from this, there is no way but to build in more make-like functionality in the compiler.

Jonas

Marco van de Voort
to Jonas Maebe
Show quoted text 10 lines
On 5 sep 2004, at 18:29, Marco van de Voort wrote: > Setup could run gtk-config and stuff it in the files. Then at least we > keep the compiler free from such patchwork, and center the "ugliness" > in > the weights file that can be operated on by the user, external tools > etc. Until someone upgrades his libraries and the next compile will be broken again. You have to work with makefiles to get around this.

This is no solution. I can use that, you can use that, 99% of our users can't.

The chances that the users get into problems with complex makefiles etc, is much harder than to have to tell them to run "fpcupdateweights" after a gtk version change.

It has nothing to do with ugliness or patchwork on the compiler or language side imo, it's simply the way unix-type systems work and you have to deal with it one way or another.

Yes, and the C-style is not the way for our users.

Show quoted text 5 lines
The C-style building by default is simply more flexible in this regard, because the compiler is dumber and you can do whatever you want in the makefiles. If the compiler largely takes over make's job and you don't want to deviate from this, there is no way but to build in more make-like functionality in the compiler.

What is exactly wrong with having the weights somewhere? I never said anything about make in compiler, since it is not an issue of make, it is an issue of order of libraries.

That C (or better: GNU) solves this with configure/makefile fiddling and outside the compiler, doesn't mean we should either. We don't have e.g. a "configure" that is kept up to date outside of our projects for major platforms to fall back on.

It was all different if this was some obscure package we were dealing with, but this is gtk2 and SDL, and a large percentage of our *nix users will deal with it sooner or later.

Jonas Maebe
to Marco van de Voort
Marco van de Voort wrote 12 lines
>> Setup could run gtk-config and stuff it in the files. Then at least >> we >> keep the compiler free from such patchwork, and center the "ugliness" >> in the weights file that can be operated on by the user, external >> tools >> etc. > > Until someone upgrades his libraries and the next compile will be > broken again. You have to work with makefiles to get around this. This is no solution. I can use that, you can use that, 99% of our users can't.

I was not thinking of requiring the users to write makefiles (I agree we simply cannot do that). More that we call this stuff in the makefile, put the results in an include file using some compiler directives and store it in the ppu. However, that's also not a solution, since the user won't be recompiling the gtk units normally. Unless we put in the command itself, store that in the ppu-file and have the compiler always call it at compile-time.

Show quoted text 5 lines
The chances that the users get into problems with complex makefiles etc, is much harder than to have to tell them to run "fpcupdateweights" after a gtk version change.

I simply think the weights stuff will not solve it. It's handy if you know beforehand which libraries will be used and which will always have to be first, but who says that the linking order always has to be the same? Especially in case the linker supports multiple namespaces and one package needs symbol X from library A, and another one from library B.

Show quoted text 11 lines
> The C-style building by default is simply more flexible in this > regard, > because the compiler is dumber and you can do whatever you want in the > makefiles. If the compiler largely takes over make's job and you don't > want to deviate from this, there is no way but to build in more > make-like functionality in the compiler. What is exactly wrong with having the weights somewhere? I never said anything about make in compiler, since it is not an issue of make, it is an issue of order of libraries.

I simply meant that our compiler does part of what make normally does (figuring out dependencies, compiling different files, ...), but it's not a full-fledged make replacement. And some kinds of things are easier to handle with make (you don't even need configure for that), since it can be told to call external programs to figure things out. Our compiler cannot do that (yet?)

Jonas

Marco van de Voort
to Jonas Maebe
Show quoted text 13 lines
On 5 sep 2004, at 20:17, Marco van de Voort wrote: > > This is no solution. I can use that, you can use that, 99% of our users > can't. I was not thinking of requiring the users to write makefiles (I agree we simply cannot do that). More that we call this stuff in the makefile, put the results in an include file using some compiler directives and store it in the ppu. However, that's also not a solution, since the user won't be recompiling the gtk units normally.

Yes, same reason why I moved it to the cfg file, and not have {$linklib xx weight} in source.

Unless we put in the command itself, store that in the ppu-file and have the compiler always call don't like this, because this is so gtk2 only. There is also SDL, and in

the future maybe a lot more "special" packages. I've had to rearrange libraries for static linking on *BSD too. (e.g. to get a fully static textmode IDE). Moreover what if gtk decides to add a linking parameter that breaks FPC ? (it's not all -l statements). It would break linking of the compiler.

How about crosslinking btw? I can transfer .so's and .a's to another machine, but can not run something like "gtk-config" there.

Show quoted text 7 lines
> after > a gtk version change. I simply think the weights stuff will not solve it. It's handy if you know beforehand which libraries will be used and which will always have to be first, but who says that the linking order always has to be the same?

That's why it is in configfile, and not 100% baked in. (though executing gtk-config each time does)

Especially in case the linker supports multiple namespaces and one package needs symbol X from library A, and another one from library B.

There is always some directed graph in dependancies that can be translated into weights. But true, this kind of problems make having one weightfile a bit difference (since e.g. Mac OS X will probably be different).

Some autogeneration of options (appended to .cfg) might be needed.

Show quoted text 11 lines
> What is exactly wrong with having the weights somewhere? I never said > anything about make in compiler, since it is not an issue of make, it > is an > issue of order of libraries. I simply meant that our compiler does part of what make normally does (figuring out dependencies, compiling different files, ...), but it's not a full-fledged make replacement. And some kinds of things are easier to handle with make (you don't even need configure for that), since it can be told to call external programs to figure things out. Our compiler cannot do that (yet?)

One aspect I don't like from this, is that directives to support that creep back in the source. The weights system goes outside .ppu and source, and only affects the linker backend as it should.

{$execute gtk-config}  ? :-)
Olle Raab
to Jonas Maebe: I was not thinking of requiring the users to write makefiles (I agree we simply cannot do…

04-09-05 20.31, skrev Jonas Maebe följande:

Show quoted text 8 lines
I simply meant that our compiler does part of what make normally does (figuring out dependencies, compiling different files, ...), but it's not a full-fledged make replacement. And some kinds of things are easier to handle with make (you don't even need configure for that), since it can be told to call external programs to figure things out. Our compiler cannot do that (yet?)

I realized that the compiler is better than make is some respects.

When working with several targets (darwin and macos), fpc can see that the ppu file is from a different target and recompile, but make can't.

Olle

Jonas Maebe
to Marco van de Voort: Yes, same reason why I moved it to the cfg file, and not have {$linklib xx weight} in…
Marco van de Voort wrote 10 lines
> Especially in case the linker supports multiple namespaces and > one package needs symbol X from library A, and another one from > library > B. There is always some directed graph in dependancies that can be translated into weights. But true, this kind of problems make having one weightfile a bit difference (since e.g. Mac OS X will probably be different).

No, it's not per system, but per package/program. Suppose there are libraries A and B which both export symbol X. One program needs symbol X from library A, and another one from library B, but both need both libraries A and B for other symbols.

You then simply cannot assign a weight to A and B so that it works correctly in all cases.

Jonas

Eduardo Morras
to Jonas Maebe
you wrote 20 lines
On 6 sep 2004, at 09:28, Marco van de Voort wrote: >>Especially in case the linker supports multiple namespaces and >>one package needs symbol X from library A, and another one from library >>B. > >There is always some directed graph in dependancies that can be translated >into weights. But true, this kind of problems make having one weightfile >a bit difference (since e.g. Mac OS X will probably be different). No, it's not per system, but per package/program. Suppose there are libraries A and B which both export symbol X. One program needs symbol X from library A, and another one from library B, but both need both libraries A and B for other symbols. You then simply cannot assign a weight to A and B so that it works correctly in all cases. Jonas

I always thought that fpc supports a.x and b.x for differenciating them, but never used it. Perhaps even a type definition in your program as

type
         Graphic = a.x;
         Incognite = b.x;

allows you use both without any problem.

P.S. From freepascal.com/advantage.html; Is this still true??

"Each unit has it's own identifiers In Pascal you never need to worry about polluting the namespace, like in C where an identifier needs to be unique accross the entire program. No, in Pascal each unit gets it's own namespace and that's very relaxed."

Las personas se dividen en tres grupos, los que saben contar y los que no. There are three groups of people, who can count, and who cannot.

Jonas Maebe
to Eduardo Morras
Eduardo Morras wrote 10 lines
> No, it's not per system, but per package/program. Suppose there are > libraries A and B which both export symbol X. One program needs > symbol X from library A, and another one from library B, but both > need both libraries A and B for other symbols. > > You then simply cannot assign a weight to A and B so that it works > correctly in all cases. I always thought that fpc supports a.x and b.x for differenciating them,

That's for units, not for libraries.

Show quoted text 6 lines
P.S. From freepascal.com/advantage.html; Is this still true?? "Each unit has it's own identifiers In Pascal you never need to worry about polluting the namespace, like in C where an identifier needs to be unique accross the entire program. No, in Pascal each unit gets it's own namespace and that's very relaxed."

Yes.

Jonas

Michael Van Canneyt
to Eduardo Morras: I always thought that fpc supports a.x and b.x for differenciating them, but never used…
Eduardo Morras wrote 38 lines
At 11:19 06/09/2004, you wrote: >On 6 sep 2004, at 09:28, Marco van de Voort wrote: > >>>Especially in case the linker supports multiple namespaces and >>>one package needs symbol X from library A, and another one from library >>>B. >> >>There is always some directed graph in dependancies that can be translated >>into weights. But true, this kind of problems make having one weightfile >>a bit difference (since e.g. Mac OS X will probably be different). > >No, it's not per system, but per package/program. Suppose there are >libraries A and B which both export symbol X. One program needs symbol X >from library A, and another one from library B, but both need both >libraries A and B for other symbols. > >You then simply cannot assign a weight to A and B so that it works >correctly in all cases. > > >Jonas I always thought that fpc supports a.x and b.x for differenciating them, but never used it. Perhaps even a type definition in your program as type Graphic = a.x; Incognite = b.x; allows you use both without any problem. P.S. From freepascal.com/advantage.html; Is this still true?? "Each unit has it's own identifiers In Pascal you never need to worry about polluting the namespace, like in C where an identifier needs to be unique accross the entire program. No, in Pascal each unit gets it's own namespace and that's very relaxed."

This is still correct.

But it is NOT true for imported C library variables. The above statement is for pure pascal identifiers.

Michael.

Olle Raab
to Eduardo Morras: I always thought that fpc supports a.x and b.x for differenciating them, but never used…

04-09-06 15.06, skrev Eduardo Morras följande:

Show quoted text 38 lines
At 11:19 06/09/2004, you wrote: > On 6 sep 2004, at 09:28, Marco van de Voort wrote: > >>> Especially in case the linker supports multiple namespaces and >>> one package needs symbol X from library A, and another one from library >>> B. >> >> There is always some directed graph in dependancies that can be translated >> into weights. But true, this kind of problems make having one weightfile >> a bit difference (since e.g. Mac OS X will probably be different). > > No, it's not per system, but per package/program. Suppose there are > libraries A and B which both export symbol X. One program needs symbol X > from library A, and another one from library B, but both need both > libraries A and B for other symbols. > > You then simply cannot assign a weight to A and B so that it works > correctly in all cases. > > > Jonas I always thought that fpc supports a.x and b.x for differenciating them, but never used it. Perhaps even a type definition in your program as type Graphic = a.x; Incognite = b.x; allows you use both without any problem. P.S. From freepascal.com/advantage.html; Is this still true?? "Each unit has it's own identifiers In Pascal you never need to worry about polluting the namespace, like in C where an identifier needs to be unique accross the entire program. No, in Pascal each unit gets it's own namespace and that's very relaxed."

Yes it is still true. FPC generates unique names for the linker.

The problem mentioned in this thread occur when linking to software written in C.

Olle

Tomas Hajny
to Eduardo Morras: I always thought that fpc supports a.x and b.x for differenciating them, but never used…

On Mon, 06 Sep 2004 15:06:30 +0200, Eduardo Morras wrote

Show quoted text 39 lines
At 11:19 06/09/2004, you wrote: >On 6 sep 2004, at 09:28, Marco van de Voort wrote: > >>>Especially in case the linker supports multiple namespaces and >>>one package needs symbol X from library A, and another one from library >>>B. >> >>There is always some directed graph in dependancies that can be translated >>into weights. But true, this kind of problems make having one weightfile >>a bit difference (since e.g. Mac OS X will probably be different). > >No, it's not per system, but per package/program. Suppose there are >libraries A and B which both export symbol X. One program needs symbol X >from library A, and another one from library B, but both need both >libraries A and B for other symbols. > >You then simply cannot assign a weight to A and B so that it works >correctly in all cases. > > >Jonas I always thought that fpc supports a.x and b.x for differenciating them, but never used it. Perhaps even a type definition in your program as type Graphic = a.x; Incognite = b.x; allows you use both without any problem. P.S. From freepascal.com/advantage.html; Is this still true?? "Each unit has it's own identifiers In Pascal you never need to worry about polluting the namespace, like in C where an identifier needs to be unique accross the entire program. No, in Pascal each unit gets it's own namespace and that's very relaxed."

The problem is exactly that we have to link C libraries in this case where such namespaces aren't available.

Tomas

Dr. Rolf Jansen
to Jonas Maebe: Yes. And for some reason, the linker picks the main of our system unit to execute instead…

Sorry, for entering the discussion at this late stage. After reading all the follow-ups to Jonas message below, I understood that the culprit is still link ordering. If I understood something wrong, then please excuse my ignorance.

If not, It might help to add a link parameter (-k...) into the fpc command line. How about:

/usr/local/bin/ppcppc MyKillerApplication.pas -k-lsdl -oMyKillerApplication

This should result in an ld command in ppas.sh where the -lsdl statement is the very first parameter:

/usr/bin/ld -lsdl -L. -o MyKillerApplication `cat link.res`

system.o and allthelocalunits.o files come very late in link.res.

I am not able to check this, but it seems to me that the linker should pick the main entry point from the sdllib in this case. I think it shouldn´t be to hard for the users of fpc to add appropriate -k... parameters to the fpc command line.

Best regards

Rolf

Jonas Maebe wrote 22 lines
On 3 sep 2004, at 11:16, Florian Klaempfl wrote: > Can't you add the SDLMain to the darwin sdl units and let this call > main? Or is main defined twice > then because the sdllib contains a main? Yes. And for some reason, the linker picks the main of our system unit to execute instead of the one in libsdl. I don't know on what basis it does this. The reason it doesn't trigger a duplicate symbol error is that the Mac OS X linker works with a two-level name space: all libraries have their own symbol namespace (although you can disable this for legacy *nix compatibility using an environment variable). Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal