www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - calling C variadic arguments with no 'argc' and only variadic

reply "Laeeth Isharc" <nospamlaeeth nospam.laeeth.com> writes:
So I ported the C API for MathGL to D, and it is up at
code.dlang.org (under dmathgl).  MathGL is a nice plotting
library.

http://mathgl.sourceforge.net/doc_en/Pictures.html#Pictures

Later I will work on porting the C++ interface, but so far it at
least works for the simplest sample.  (Not tried anything else as
they are all written in C++).

DMD gave me an error message for the following declarations:

double mgl_rnd (...);
double mgl_rnd_ (...);

It says I need at least one fixed argument first.  But the C
headers are as they are.

I could work around this by writing a C stub

double mgl_rnd_(int dummy, ...)

but is there any way to call these functions without this
workaround?
Mar 17 2015
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 03/17/2015 06:13 PM, Laeeth Isharc wrote:

 DMD gave me an error message for the following declarations:

 double mgl_rnd (...);
 double mgl_rnd_ (...);
Are you sure those are the right signatures? I don't think those functions take any parameters at all. I would try these: double mgl_rnd (); double mgl_rnd_ (); Ali
Mar 17 2015
parent "Laeeth Isharc" <Laeeth.nospam nospam-laeeth.com> writes:
On Wednesday, 18 March 2015 at 05:38:40 UTC, Ali Çehreli wrote:
 On 03/17/2015 06:13 PM, Laeeth Isharc wrote:

 DMD gave me an error message for the following declarations:

 double mgl_rnd (...);
 double mgl_rnd_ (...);
Are you sure those are the right signatures? I don't think those functions take any parameters at all. I would try these: double mgl_rnd (); double mgl_rnd_ (); Ali
My mistake. Dstep got confused in the translation and wrote the sig as ...and I was tired and didnt check. Thanks for looking into it.
Mar 18 2015