Using a C function with command line parameters

Steven Schveighoffer schveiguy at yahoo.com
Tue Jul 5 05:06:32 PDT 2011


On Tue, 05 Jul 2011 00:29:14 -0400, Jonathan Sternberg  
<jonathansternberg at gmail.com> wrote:

> It's one of the applications that consumes command line arguments. So if  
> I wanted
> to implement this, a copy of the D strings (and null terminated) would  
> have to be
> made. I would also likely need to add another slot to the command line  
> arguments
> as usually the command line is null terminated for C programs.
>
> Generally, command line arguments don't modify the parameters. But C  
> isn't
> particularly good at using const correctness.
>
> A wrapper around glutInit would require copying the array to a C-style  
> array,
> calling the extern (C)'d function, then copying back the changes to the  
> D side
> back to a D style array. Right?

Yes, probably the best thing to do.

-Steve


More information about the Digitalmars-d-learn mailing list