Sign in Join

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

Mailing lists / fpc-devel / 2002-08

crash

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Maxim Artemev

Hello.
From the manual:
[--cut--]
'If the procedure is declared with the cdecl modifier, then the compiler will pass the array as a C compiler would pass it. This, in effect, emulates the C construct of a varable number of arguments, as the following example will show:'
[--cut--]

This works only under *NIX (I was tested under FreeBSD)

Under Win32 when I'm trying to call a declared function in DLL with C-variable array parameters it makes a crash with run-time error 217 (perhaps stack overflow?).
Any solve of this problem?

Under FreeBSD all is ok.

$ ppc386 -i
Free Pascal Compiler version 1.0.4
Compiler Date : 2000/12/30
Compiler Target: i386

---
With best regards. Max Artemev.
Student of the mathematical department of the Pedagogic University of Moscow, Russia.
The Raccoons Homepage http://theraccoons.lionking.ru

Reply by email

Maxim Artemev
to Michael Van Canneyt: Functions in Windows DLLs usually use the stdcall calling convention. Are you sure that…

----- Original Message -----

Earlier message 43 lines
From: Michael Van Canneyt To: Sent: Tuesday, August 06, 2002 11:21 AM Subject: Re: [fpc-devel]crash > > > On Mon, 5 Aug 2002, Maxim Artemev wrote: > > > Hello. > > > > >From the manual: > > [--cut--] > > 'If the procedure is declared with the cdecl modifier, then the compiler > > will pass the array as a C compiler would pass it. This, in effect, emulates > > the C construct of a varable number of arguments, as the following example > > will show:' > > [--cut--] > > > > This works only under *NIX (I was tested under FreeBSD) > > > > Under Win32 when I'm trying to call a declared function in DLL with > > C-variable array parameters it makes a crash with run-time error 217 > > (perhaps stack overflow?). > > Any solve of this problem? > > Functions in Windows DLLs usually use the stdcall calling convention. > Are you sure that cdecl is the correct covention for the library > you are trying to use ? > Yes. I'm translating C headers of Tcl library. None of __stdcall or PASCAL or WINAPI wasn't declared. extern __attribute__(( dllimport )) void Tcl_AppendResult(Tcl_Interp * interp , ...); translated to: procedure Tcl_AppendResult(interp: pTcl_Interp; args: array of const); cdecl; external TCL_LIBRARY;

Reply by email

Michael Van Canneyt
to Maxim Artemev: Hello. From the manual: [--cut--] 'If the procedure is declared with the cdecl modifier,…
Maxim Artemev wrote 16 lines
Hello. >From the manual: [--cut--] 'If the procedure is declared with the cdecl modifier, then the compiler will pass the array as a C compiler would pass it. This, in effect, emulates the C construct of a varable number of arguments, as the following example will show:' [--cut--] This works only under *NIX (I was tested under FreeBSD) Under Win32 when I'm trying to call a declared function in DLL with C-variable array parameters it makes a crash with run-time error 217 (perhaps stack overflow?). Any solve of this problem?

Functions in Windows DLLs usually use the stdcall calling convention. Are you sure that cdecl is the correct covention for the library you are trying to use ?

Michael.

Reply by email