Sign in Join

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

Mailing lists / lazarus / 2012-01

Libc functions and types

11 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Sven Barth
to Udav
Udav wrote
Well, I guess one option is to rebuild RTL with FPC_USE_LIBC defined. Another one is to define needed structures myself and implement function calls via syscall - what, I believe, is recommended way. But how can I determine the number of the function I want to call?

Unit libc is deprecated, yes, but its functionality is not. Most functionality is available via different units like BaseUnix and so on. A "grep -ri TheStructureYouSearch $fpcdir/rtl" should often help you in finding your structure (it should often work with functions as well).

Regards,
Sven

Reply by email

Andreas Schneider
to Udav
Udav wrote
Sven, I tried searching inside RTL and localtime_r() is only declared in the libc/newlibc units. I think I'd have to use it because I'm trying to make my units RAD/FPC compatible and RAD uses libc for POSIX code and doesn't worry about it.

With "RAD" do you mean "Delphi"? Because "RAD" stands for Rapid Application Development and does not really fit into the context of the rest of your message.

Best Regards, Andreas

Reply by email

Udav
to Andreas Schneider

Andreas Schneider wrote

Show quoted text 5 lines
With "RAD" do you mean "Delphi"? Because "RAD" stands for Rapid Application Development and does not really fit into the context of the rest of your message.

Yeah, I mean Emb-ro RAD Studio (namely XE2 as they introduced multi-platform support in this version)

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Libc-functions-and-types-tp3665361p3665786.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Marco van de Voort
to Udav
Udav wrote 6 lines
> With "RAD" do you mean "Delphi"? Because "RAD" stands for Rapid > Application Development and does not really fit into the context of > the rest of your message. > Yeah, I mean Emb-ro RAD Studio (namely XE2 as they introduced multi-platform support in this version)

There is no Embarcadero Radstudio that supports Linux. In ancient times there was Kylix, but it was buried. A part of it escaped, called unit libc, but we finally caught up with it, and now it is dead and buried too.

Just in case, I'm sitting on the grave with a shotgun.

Read all about here: http://wiki.freepascal.org/libc_unit

Reply by email

Craig Peterson
to Marco van de Voort
Marco van de Voort wrote
There is no Embarcadero Radstudio that supports Linux. In ancient times there was Kylix, but it was buried. A part of it escaped, called unit libc, but we finally caught up with it, and now it is dead and buried too.

And now they have the Posix.* units which provide the same functionality in a more cross-platform manner. The original poster gave localtime_r as a specific example. It's part of the OpenGroup's Unix specification (in time.h), but FreePascal only exposes it in libc.pas. If you don't want people using that header you really should provide a better alternative than just making everyone redeclare everything in their own units.

Craig Peterson Scooter Software

Reply by email

Udav
to Craig Peterson

Marco van de Voort wrote

Show quoted text 6 lines
There is no Embarcadero Radstudio that supports Linux. In ancient times there was Kylix, but it was buried. A part of it escaped, called unit libc, but we finally caught up with it, and now it is dead and buried too.

They have MacOSX support in XE2 and surely will do Linux in the next version.

Craig Peterson wrote

Show quoted text 6 lines
If you don't want people using that header you really should provide a better alternative than just making everyone redeclare everything in their own units.

Absolutely! And if one just try searching through FPC RTL files for "tm" record he'll find it is declared about 8 times in various units.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Libc-functions-and-types-tp3665361p3668419.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Marco van de Voort
to Craig Peterson: And now they have the Posix.* units which provide the same functionality in a more…
Craig Peterson wrote 7 lines
On 1/17/2012 2:49 PM, Marco van de Voort wrote: > There is no Embarcadero Radstudio that supports Linux. In ancient times > there was Kylix, but it was buried. A part of it escaped, called unit libc, > but we finally caught up with it, and now it is dead and buried too. And now they have the Posix.* units which provide the same functionality in a more cross-platform manner.

Not supported by FPC atm.

The original poster gave localtime_r as a specific example. It's part of the OpenGroup's Unix specification (in time.h), but FreePascal only exposes it in libc.pas.

FPC doesn't expose it in any portable manner.

If you don't want people using that header you really should provide a better alternative than just making everyone redeclare everything in their own units.

Patches and submissions of such units are welcome. Note that this is the first time that this has come up.

For calls for which it has come up more frequently, this has already happened (password and network resolving among others)

Reply by email

Marco van de Voort
to Udav: Marco van de Voort wrote They have MacOSX support in XE2 and surely will do Linux in the…
Udav wrote 6 lines
> better > alternative than just making everyone redeclare everything in their own > units. > Absolutely! And if one just try searching through FPC RTL files for "tm" record he'll find it is declared about 8 times in various units.

That's perfectly logical because every *nix version has its own version. (and they might even differ between architectures. Linux specially has that tendency due to x86 legacy)

Reply by email