www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Two questions about converting a C header file

reply Juanjo Alvarez <juanjux thatwebmailofgoogleproperty.com> writes:
Hi,

I'm converting a C header file but there are two things left:

1. If the header file contains some D reserved word (in my case, "in" and 
"out" in a struct) what is the best way to workaround it? Do you write 
another C file and link about it?

2. What about va_list?
Sep 23 2010
next sibling parent Juanjo Alvarez <juanjux thatwebmailofgoogleproperty.com> writes:
Auto reply, found both:

1. Just rename the varname, stupid stupid stupid!

2. import std.c.stdarg

On Thu, 23 Sep 2010 19:44:44 +0000, Juanjo Alvarez wrote:

 Hi,
 
 I'm converting a C header file but there are two things left:
 
 1. If the header file contains some D reserved word (in my case, "in"
 and "out" in a struct) what is the best way to workaround it? Do you
 write another C file and link about it?
 
 2. What about va_list?

Sep 23 2010
prev sibling parent Sean Kelly <sean invisibleduck.org> writes:
Juanjo Alvarez Wrote:

 Hi,
 
 I'm converting a C header file but there are two things left:
 
 1. If the header file contains some D reserved word (in my case, "in" and 
 "out" in a struct) what is the best way to workaround it? Do you write 
 another C file and link about it?

The convention I use for reserved words is to append an underscore to the word. So code may need to be changed a bit, but it's as close as possible to the original.
 2. What about va_list?

If I'm following you correctly, see core.stdc.stdarg.
Sep 24 2010