Re: [fpc-pascal] array of const with cdecl procedure

2012-11-12 Thread Bernd
2012/11/11 Jonas Maebe : > No, it is not possible. There are no Pascal (or C, for that matter) > expressions that map to particular registers on entry into the function. ok, my wording was wrong. What I really meant to say was that if I am absolutely determined to find a solution because I have

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Mark Morgan Lloyd
Jonas Maebe wrote: Is there a document somewhere that specifies how exactly cdecl varargs is implemented on the different platforms? There is one such document per ABI. These individual ABI documents are located all over the web. E.g. the official x86-64 ABI can be found at http://www.x86-64

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe
On 11 Nov 2012, at 21:17, Bernd wrote: > 2012/11/11 Jonas Maebe : > >> Then you probably only read about i386 ABIs (and maybe m68k). > > But a bunch of ifdefs should do the trick then, it should still be > possible to implement every possible implementation in pascal somehow. No, it is not pos

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Jonas Maebe : > Then you probably only read about i386 ABIs (and maybe m68k). But a bunch of ifdefs should do the trick then, it should still be possible to implement every possible implementation in pascal somehow. Is there a document somewhere that specifies how exactly cdecl vararg

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe
On 11 Nov 2012, at 20:57, Bernd wrote: > 2012/11/11 Jonas Maebe : > >> No, because the C varargs calling convention does not simply pass the >> parameters on the stack on most platforms. > > Where else are the arguments if not on the stack? In registers. > Everything I have > read so far abo

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Jonas Maebe : > No, because the C varargs calling convention does not simply pass the > parameters on the stack on most platforms. Where else are the arguments if not on the stack? Everything I have read so far about varargs and cdecl says they are on the stack. __

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe
On 11 Nov 2012, at 20:42, Bernd wrote: > Wouldn't it be possible to write a function in pascal that declares a > simple longint parameter instead of the varargs and then inside the > function use the stack pointer (the address of that argument) to read > the entire list from the stack directly?

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Sven Barth : > Yes and this is exactly what the change states. You can not write "varargs" > functions in Pascal that can be accessed from C. Wouldn't it be possible to write a function in pascal that declares a simple longint parameter instead of the varargs and then inside the functi

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Sven Barth
On 11.11.2012 13:58, ik wrote: On Sun, Nov 11, 2012 at 2:54 PM, Sven Barth wrote: On 11.11.2012 13:40, ik wrote: Hello, I'm trying to write a shard library of my own that you can use with C as well. I'm using mode fpc, and not objfpc. I created something like this: ... procedure varargs_ex

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread ik
On Sun, Nov 11, 2012 at 2:54 PM, Sven Barth wrote: > On 11.11.2012 13:40, ik wrote: >> >> Hello, >> >> I'm trying to write a shard library of my own that you can use with C >> as well. I'm using mode fpc, and not objfpc. >> >> I created something like this: >> >> ... >> procedure varargs_example(p

Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Sven Barth
On 11.11.2012 13:40, ik wrote: Hello, I'm trying to write a shard library of my own that you can use with C as well. I'm using mode fpc, and not objfpc. I created something like this: ... procedure varargs_example(params : array of consts); cdecl; ... The compiler report an error: Error:Type

[fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread ik
Hello, I'm trying to write a shard library of my own that you can use with C as well. I'm using mode fpc, and not objfpc. I created something like this: ... procedure varargs_example(params : array of consts); cdecl; ... The compiler report an error: Error:Type identifier expected Fatal: Syntax