Sign in Join

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

Mailing lists / fpc-pascal / 2009-07

Missing functions in FPCMacOSAll.pas

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

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

Tobias Giesen

Hello,

frequently I need to use a function that is missing in FPCMacOSAll.pas. Trying to declare it myself usually results in successful compilation and linking, but most of the time the functions crash at run time. So I wonder if these are not implemented or if I declare them wrong.

Today I need the function FSMountServerVolumeSync and I declared it
like this:
function FSMountServerVolumeSync(const url:CFURLRef;
     const mountDir:CFURLRef;
     const user:CFStringRef;
     const password:CFStringRef;
     const mountedVolumeRefNum:FSVolumeRefNumPtr):OSStatus;
  external name '_FSMountServerVolumeSync';

It compiles and links but it crashes (access violation).

What am I doing wrong? Is this only for Cocoa? How can I make it available?

Previously, I have been successful with the following function:

function LSOpenItemsWithRole(
           const (*var*) inRef: FSRef;
           const inItemCount: CFIndex;
           const inRole: LSRolesMask;
           const inAEParam: UInt32;
           const inAppParams: LSApplicationParameters;
           const outPSNs: ProcessSerialNumberPtr;
           const inMaxPSNCount: CFIndex
           ): OSStatus;
external name '_LSOpenItemsWithRole';

This function, too, is listed as available in MacOS X but not available in CarbonLib.

What's the difference between these two functions, I wonder ...

Cheers,
Tobias

Paul Ishenin
to Tobias Giesen
Tobias Giesen wrote 19 lines
frequently I need to use a function that is missing in FPCMacOSAll.pas. Trying to declare it myself usually results in successful compilation and linking, but most of the time the functions crash at run time. So I wonder if these are not implemented or if I declare them wrong. Today I need the function FSMountServerVolumeSync and I declared it like this: function FSMountServerVolumeSync(const url:CFURLRef; const mountDir:CFURLRef; const user:CFStringRef; const password:CFStringRef; const mountedVolumeRefNum:FSVolumeRefNumPtr):OSStatus; external name '_FSMountServerVolumeSync'; It compiles and links but it crashes (access violation). What am I doing wrong? Is this only for Cocoa? How can I make it available?

I think you foget to use correct calling conventon modifier. As I know you should use 'mwpascal' modifier.

Best regards,
Paul Ishenin.

Tobias Giesen
to Paul Ishenin

Hi,

thanks very much, it works now!

I created a new unit for my declarations and just copied the whole compiler instructions block from FPMacOSAll.pas:

{$mode macpas}
{$packenum 1}
{$macro on}
{$inline on}
{$calling mwpascal}

So now I have access to a whole range of super advanced additional stuff like FSMountServerVolumeSync ;=)

Cheers,
Tobias

greim
to Tobias Giesen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

i just tried to compile a cross compiler
linux 386 to linux arm
(Suse 11.1 to a SSV DIL Net PC / 9200 Atmel AT91RM9200)

I downloades the latest :
.....
Download Daily Source Snapshot of the Fixes Tree
Entire fpc sources archive of the fixes branch: fpc.zip (24 MB) from the website
......

Also... and there i am not sure:
Package Binary
GNU Binutils arm-binutils-2.16-1.i386.rpm
and install it.

Then i started the compiler (as root ???) with :
make clean all CPU_TARGET=arm OS_TARGET=linux
BINUTILSPREFIX=/usr/arm/bin/arm-unknown-linux-gnu

The compiler (2.2.4) was running some minutes.
But no ppcarm there afterwards.
Any hint???

i know that this is not a new question , but all answers in the last 4 years seem to be a little bit different....

Or is there a running precompiled package anywhere or a rpm (oh yeah i know i am a softiii...)

Mit freundlichen Grüßen

Markus Greim

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkpk4zkACgkQWVkhSqgWKAKikgCgsZxeZ+P/DMXU+wYoIZoJbbkZ O1QAnAjEi2T8gQLYorRPbjjUJl/WCmA+
=Q9PB
-----END PGP SIGNATURE-----

Henry Vermaak
to greim

2009/7/20 greim :

Show quoted text 28 lines
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, i just tried to compile a cross compiler linux 386 to linux arm (Suse 11.1 to a SSV DIL Net PC / 9200 Atmel AT91RM9200) I downloades the latest : ..... Download Daily Source Snapshot of the Fixes Tree Entire fpc sources archive of the fixes branch: fpc.zip (24 MB) from the website ...... Also... and there i am not sure: Package Binary GNU Binutils    arm-binutils-2.16-1.i386.rpm and install it. Then i started the compiler (as root ???) with : make clean all CPU_TARGET=arm OS_TARGET=linux BINUTILSPREFIX=/usr/arm/bin/arm-unknown-linux-gnu The compiler (2.2.4) was running some minutes. But no ppcarm there afterwards. Any hint???

If you haven't done a "make install", then the compiler should be in ./compiler/.

Henry

Jonas Maebe
to Henry Vermaak
Henry Vermaak wrote 11 lines
2009/7/20 greim : > Then i started the compiler (as root ???) with : > make clean all CPU_TARGET=arm OS_TARGET=linux > BINUTILSPREFIX=/usr/arm/bin/arm-unknown-linux-gnu > > The compiler (2.2.4) was running some minutes. > But no ppcarm there afterwards. > Any hint??? If you haven't done a "make install", then the compiler should be in ./compiler/.

And it will be called ppcrossarm (because it's a cross-compiler, rather than a native compiler).

To make it clear: the above command will create a non-EABI ARM little endian compiler, using the FPA floating point unit. If you want to use softfloat, add OPT="-Cfsoft". Moreover, if you (the original poster) intend to target an ARM-EABI platform, I would strongly recommend to use FPC 2.3.1 instead, because 2.2.4 contains quite a few bugs for those platforms. When using 2.2.x, at the very least you also have to add -O- to the OPT parameters.

Jonas

greim
to Henry Vermaak: 2009/7/20 greim : If you haven't done a "make install", then the compiler should be in…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hallo Henry,

Show quoted text 24 lines
> i just tried to compile a cross compiler > linux 386 to linux arm > (Suse 11.1 to a SSV DIL Net PC / 9200 Atmel AT91RM9200) > > I downloades the latest : > ..... > Download Daily Source Snapshot of the Fixes Tree > Entire fpc sources archive of the fixes branch: fpc.zip (24 MB) > from the website > ...... > > Also... and there i am not sure: > Package Binary > GNU Binutils arm-binutils-2.16-1.i386.rpm > and install it. > > Then i started the compiler (as root ???) with : > make clean all CPU_TARGET=arm OS_TARGET=linux > BINUTILSPREFIX=/usr/arm/bin/arm-unknown-linux-gnu > > The compiler (2.2.4) was running some minutes. > But no ppcarm there afterwards. > Any hint???

so thanks i am some steps further

i now installed the arm binutils from the Suse distribution ist version 2.19 instead of 2.16 and installed in

/opt/cross/arm-linux/bin/

by Yast

So i now mad a call:

make all CPU_TARGET=arm OS_TARGET=linux
BINUTILSPREFIX=/opt/cross/arm-linux/bin/

an voila it compiles... and ppcrossarm was in ./compiler fantastic.

Then i did a

make install CPU_TARGET=arm OS_TARGET=linux
BINUTILSPREFIX=/opt/cross/arm-linux/bin/

and now there are some files in
/usr/bin

looks fine!

But now i did a
ppcrossarm -B hallo.pas

The compiler seems to run, and making the s-file, but assembling the s-file failed, with more then 20 error messages. like

makuslinux3:/home/markus/arm # ppcrossarm -B -Aas hallo.pas Free Pascal Compiler version 2.3.1 [2009/07/21] for arm Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for ARM
Compiling hallo.pas
Assembling hallo
hallo.s: Assembler messages:
hallo.s:11: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:11: Error: junk at end of line, first unrecognized character is `P' hallo.s:14: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:14: Error: junk at end of line, first unrecognized character is `m' hallo.s:16: Error: too many memory references for `mov' hallo.s:17: Error: no such instruction: `stmfd r13!,{r4,r11,r12,r14,r15}' hallo.s:18: Error: too many memory references for `sub' hallo.s:19: Error: too many memory references for `sub' hallo.s:20: Error: no such instruction: `bl FPC_INITIALIZEUNITS' hallo.s:21: Error: no such instruction: `bl fpc_get_output' hallo.s:22: Error: too many memory references for `mov' hallo.s:23: Error: too many memory references for `mov' hallo.s:24: Error: no such instruction: `ldr r2,.Lj9' hallo.s:25: Error: expecting operand after ','; got nothing hallo.s:26: Error: no such instruction: `bl fpc_write_text_shortstr' hallo.s:27: Error: no such instruction: `bl FPC_IOCHECK' hallo.s:28: Error: too many memory references for `mov' hallo.s:29: Error: no such instruction: `bl fpc_writeln_end' hallo.s:30: Error: no such instruction: `bl FPC_IOCHECK' hallo.s:31: Error: no such ins.................................... etc.

any further idea..???

Thanks!

Markus Greim

Show quoted text 5 lines
If you haven't done a "make install", then the compiler should be in ./compiler/. Henry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkpljGYACgkQWVkhSqgWKAJJkgCgrSrZF2UPXAfWzxvUhq/isJaL 3vUAoLn57wjZRAE5EUh8fPsDfCmDZbnc
=bJeb
-----END PGP SIGNATURE-----

Jonas Maebe
to greim
greim wrote 21 lines
The compiler seems to run, and making the s-file, but assembling the s-file failed, with more then 20 error messages. like makuslinux3:/home/markus/arm # ppcrossarm -B -Aas hallo.pas Free Pascal Compiler version 2.3.1 [2009/07/21] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for ARM Compiling hallo.pas Assembling hallo hallo.s: Assembler messages: hallo.s:11: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:11: Error: junk at end of line, first unrecognized character is `P' hallo.s:14: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:14: Error: junk at end of line, first unrecognized character is `m' hallo.s:16: Error: too many memory references for `mov' hallo.s:17: Error: no such instruction: `stmfd r13!, {r4,r11,r12,r14,r15}'

[snip]

etc. any further idea..???

The compiler is calling your i386/x86_64 assembler instead of the ARM one. I guess /opt/cross/arm-linux/bin/ is not in your path.

Jonas

Henry Vermaak
to greim: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 so thanks i am some steps further i now…

2009/7/21 greim :

Show quoted text 63 lines
so thanks i am some steps further i now installed the arm binutils from the Suse distribution ist version 2.19 instead of 2.16 and installed in /opt/cross/arm-linux/bin/ by Yast So i now mad a call: make all CPU_TARGET=arm OS_TARGET=linux BINUTILSPREFIX=/opt/cross/arm-linux/bin/ an voila it compiles... and ppcrossarm was in ./compiler fantastic. Then i did a make install CPU_TARGET=arm OS_TARGET=linux BINUTILSPREFIX=/opt/cross/arm-linux/bin/ and now there are some files in /usr/bin looks fine! But now i did a ppcrossarm -B hallo.pas The compiler seems to run, and making the s-file, but assembling the s-file failed, with more then 20 error messages. like makuslinux3:/home/markus/arm # ppcrossarm -B -Aas hallo.pas Free Pascal Compiler version 2.3.1 [2009/07/21] for arm Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for ARM Compiling hallo.pas Assembling hallo hallo.s: Assembler messages: hallo.s:11: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:11: Error: junk at end of line, first unrecognized character is `P' hallo.s:14: Warning: .type pseudo-op used outside of .def/.endef ignored. hallo.s:14: Error: junk at end of line, first unrecognized character is `m' hallo.s:16: Error: too many memory references for `mov' hallo.s:17: Error: no such instruction: `stmfd r13!,{r4,r11,r12,r14,r15}' hallo.s:18: Error: too many memory references for `sub' hallo.s:19: Error: too many memory references for `sub' hallo.s:20: Error: no such instruction: `bl FPC_INITIALIZEUNITS' hallo.s:21: Error: no such instruction: `bl fpc_get_output' hallo.s:22: Error: too many memory references for `mov' hallo.s:23: Error: too many memory references for `mov' hallo.s:24: Error: no such instruction: `ldr r2,.Lj9' hallo.s:25: Error: expecting operand after ','; got nothing hallo.s:26: Error: no such instruction: `bl fpc_write_text_shortstr' hallo.s:27: Error: no such instruction: `bl FPC_IOCHECK' hallo.s:28: Error: too many memory references for `mov' hallo.s:29: Error: no such instruction: `bl fpc_writeln_end' hallo.s:30: Error: no such instruction: `bl FPC_IOCHECK' hallo.s:31: Error: no such ins.................................... etc. any further idea..???

Using the wrong assembler? Make sure your arm assembler and linker is on the path.

Henry

Carsten Bager
to Henry Vermaak

When I build the compiler i use this

--------- Linux ----------------
#!/bin/sh
export PATH=$PATH:/pp/bin
export PATH=$PATH:/Fpc/ArmBin/218
make clean all OS_TARGET=linux CPU_TARGET=arm PP=/pp/bin/fpc BINUTILSPREFIX=arm-linux-

--------Windows ----------------------------
PATH = c:\fpc\2.2.2\bin\i386-win32;c:\pp\bin\Arm
make clean all OS_TARGET=linux CPU_TARGET=arm BINUTILSPREFIX=arm-linux-

This works fine with the 222 and 223 version

Regards

Carsten

Med venlig hilsen
Carsten Bager

BEAS A/S
Brørupvænget 10
DK-7650 Bøvlingbjerg
Tlf. : +45 9788 5222 Fax : +45 9788 5434
www.beas.dk

greim
to Carsten Bager

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Carsten et. al.

thanks for your help. I think i am to stupid to set the right paths and links. Maybe Suse is a little bit strange here.

Finally i copied the file Carsten has provided
at
http://www.freepascal.dk/
and it compiles...
My first Hello World on the ARM is also ok.

Thanks a lot

Markus Greim

Show quoted text 36 lines
When I build the compiler i use this --------- Linux ---------------- #!/bin/sh export PATH=$PATH:/pp/bin export PATH=$PATH:/Fpc/ArmBin/218 make clean all OS_TARGET=linux CPU_TARGET=arm PP=/pp/bin/fpc BINUTILSPREFIX=arm-linux- --------Windows ---------------------------- PATH = c:\fpc\2.2.2\bin\i386-win32;c:\pp\bin\Arm make clean all OS_TARGET=linux CPU_TARGET=arm BINUTILSPREFIX=arm-linux- This works fine with the 222 and 223 version Regards Carsten Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

- --

Mit freundlichen Grüßen

Markus Greim

Schleibinger Geräte
Teubert u. Greim GmbH
Gewerbestrasse 4
84428 Buchbach
Germany

Tel. +49 8086 94010
Fax. +49 8086 94014
Mobil +49 172 8 999 196
http://www.schleibinger.com

Amtsgericht Traunstein HRB 9646
Geschäftsführer:
Dipl.-Ing. (FH) Oliver Teubert
Dipl.-Ing. (Univ.) Markus Greim
UST-ID. DE 174 175 046
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iEYEARECAAYFAkpl0fwACgkQWVkhSqgWKAImWACgi/8MAmTRr7bMipMvN9rhWIKL OPgAn1sKOF05hGygMog8FJx2DwCps1l+
=3tZm
-----END PGP SIGNATURE-----