Sign in Join

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

Mailing lists / fpc-pascal / 2006-01

FreePascal in a FreeBSD

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Evandro Sestrem

Hello,

I'm trying compile a project using FreePascal (2.0.2 [2005/11/17] for i386) in a FreeBSD 4.1.

I can compile this project in Delphi (in a Windows) and Kylix (in a Debian), but infortunatelly I can't compile this project using FreePascal/FreeBSD.

I have this code:

{$IFDEF WIN32}
uses
  Windows;
{$ENDIF}
{$IFDEF LINUX}
uses
  Libc;
{$ENDIF}

to use the getenv function.

What the correspondent for FreeBSD to Libc?

Thanks in advance!

Evandro Sestrem
www.blueone.com.br

No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/227 - Release Date: 11/1/2006
Marco van de Voort
to Evandro Sestrem
I'm trying compile a project using FreePascal (2.0.2 [2005/11/17] for i386) in a FreeBSD 4.1.

That's an old one (the FreeBSD I mean)

I can compile this project in Delphi (in a Windows) and Kylix (in a Debian), but infortunatelly I can't compile this project using FreePascal/FreeBSD.

That's because you
1) use OS specific units for something not OS specific. -> Best solution: use sysutils.getenvironmentvariable
2) For the *nix case, you use a Kylix compability unit (libc) which, like Kylix, is linux/i386 only.
-> if you want to do this use baseunix.fpgetenv

to use the getenv function. What the correspondent for FreeBSD to Libc?

Baseunix. Use this on Linux also, unit libc is only for keeping sourcebases Kylix compatible, and it is not recommended for portable application development.

pierre charland
to Evandro Sestrem: I'm trying compile a project using FreePascal (2.0.2 [2005/11/17] for i386) in a FreeBSD…

I don't know, I'm new to FreePascal.

I tried <uses Windows> but had to remove it
because it conflicted with <uses graph>.

You could check the <Win32 API help files>,
download it from http://www.freepascal.org/docs.html.

Those help files are too complex for me to understand. In there I find no getenv function,
only GetEnvironmentStrings and GetEnvironmentVariable.

If I learn more I will let you know.

Show quoted text 48 lines
From: "Evandro Sestrem" Reply-To: FPC-Pascal users discussions To: Subject: [fpc-pascal] FreePascal in a FreeBSD Date: Thu, 12 Jan 2006 16:46:04 -0300 Hello, I'm trying compile a project using FreePascal (2.0.2 [2005/11/17] for i386) in a FreeBSD 4.1. I can compile this project in Delphi (in a Windows) and Kylix (in a Debian), but infortunatelly I can't compile this project using FreePascal/FreeBSD. I have this code: {$IFDEF WIN32} uses Windows; {$ENDIF} {$IFDEF LINUX} uses Libc; {$ENDIF} to use the getenv function. What the correspondent for FreeBSD to Libc? Thanks in advance! Evandro Sestrem www.blueone.com.br -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/227 - Release Date: 11/1/2006 _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Evandro Sestrem
to Evandro Sestrem: I'm trying compile a project using FreePascal (2.0.2 [2005/11/17] for i386) in a FreeBSD…

Thank you very much, Marco! You really helped me a lot.

Pierre: you can use de BaseUnix.GetEnvironmentVariable almost the same like you use Windows.GetEnvironmentVariable in Delphi.

Now I'm looking for correspondents for these Windows APIs in the FreePascal:
- LoadLibrary (Linux: dlopen)
- FreeLibrary (Linux: dlclose)
- GetProcAddress (Linux: dlsym)

Can somebody help me?

Best regards,

Evandro Sestrem

No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/228 - Release Date: 12/1/2006
Marco van de Voort
to Evandro Sestrem
Thank you very much, Marco! You really helped me a lot. Pierre: you can use de BaseUnix.GetEnvironmentVariable almost the same like you use Windows.GetEnvironmentVariable in Delphi.

baseunix.fpgetenv it is :-)

baseunix mostly contains Unix calls prefixed with "fp" to avoid unnecessary nameclashes

Show quoted text 6 lines
Now I'm looking for correspondents for these Windows APIs in the FreePascal: - LoadLibrary (Linux: dlopen) - FreeLibrary (Linux: dlclose) - GetProcAddress (Linux: dlsym) Can somebody help me?

Use unit dynlibs. These calls are abstracted in that unit to work over all OSes that support such functionality.