Sign in Join

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

Mailing lists / fpc-pascal / 2009-11

Using C functions

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Wimpie Nortje

Hi all,

Is there any way to use a C library that use the __fastcall calling convention?

Jonas Maebe
to Wimpie Nortje
Wimpie Nortje wrote
Is there any way to use a C library that use the __fastcall calling convention?

Not at this time. Also note that that the fastcall convention is not standardised and varies between different C compilers.

Jonas

Wimpie Nortje
to Jonas Maebe
Jonas Maebe wrote 9 lines
On 21 Nov 2009, at 20:16, Wimpie Nortje wrote: > Is there any way to use a C library that use the __fastcall calling convention? > Not at this time. Also note that that the fastcall convention is not standardised and varies between different C compilers.

Thanks, I thought so.

I am considering to write a C library (cdecl) to wrap the calls to the C library(fastcall), but it doesn't feel right.

Ivo Steinmann
to Wimpie Nortje
Show quoted text 21 lines
Jonas Maebe wrote: > On 21 Nov 2009, at 20:16, Wimpie Nortje wrote: > > >> Is there any way to use a C library that use the __fastcall calling convention? >> > > Not at this time. Also note that that the fastcall convention is not standardised and varies between different C compilers. > > Thanks, I thought so. I am considering to write a C library (cdecl) to wrap the calls to the C library(fastcall), but it doesn't feel right. ------------------------------------------------------------------------ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

it's better to do it this way instead relying on something not standardised...

Andrew Haines
to Ivo Steinmann
Ivo Steinmann wrote 7 lines
>> > Thanks, I thought so. > > I am considering to write a C library (cdecl) to wrap the calls to the > C library(fastcall), but it doesn't feel right. > ------------------------------------------------------------------------ >

You can compile your c wrapper and link the .o file directly in your pascal unit so that a .so is not needed at runtime.

{$link my_c_wrapper.o}

Regards,

Andrew