FreePascal in a FreeBSD

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

FreePascal in a FreeBSD

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FreePascal in a FreeBSD

Marco van de Voort
> 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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RE: FreePascal in a FreeBSD

pierre charland
In reply to this post by Evandro Sestrem
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.


>From: "Evandro Sestrem" <[hidden email]>
>Reply-To: FPC-Pascal users discussions <[hidden email]>
>To: <[hidden email]>
>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  -  [hidden email]
>http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

RES: FreePascal in a FreeBSD

Evandro Sestrem
In reply to this post by 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.


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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: RES: FreePascal in a FreeBSD

Jonas Maebe-2

On 13 jan 2006, at 23:52, Evandro Sestrem wrote:

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

Add the unit "dynlibs" to your program and all these functions are  
available.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: RES: FreePascal in a FreeBSD

Marco van de Voort
In reply to this post by 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

> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal