#define trouble

dnewbie run3 at myopera.com
Mon Nov 26 22:05:56 PST 2012


I have the following C struct from ldap.h

typedef struct ldapmod {
	int	mod_op;
	char *mod_type;
	union mod_vals_u {
		char **modv_strvals;
		struct berval **modv_bvals;
	} mod_vals;
#define mod_values	mod_vals.modv_strvals
#define mod_bvalues	mod_vals.modv_bvals
} LDAPMod;

It is used like this:
LDAPMod title;
title.mod_values = x;

I wonder how can I write the line 'title.mod_values = x;' in D.
Currently I do like this:
	
struct ldapmod {
	int	mod_op;
	char* mod_type;
	union mod_vals_u {
		char**  modv_strvals;
		berval** modv_bvals;
	}
	mod_vals_u mod_vals;
}
alias ldapmod LDAPMod;

LDAPMod title;
title.mod_vals.modv_strvals = x;




More information about the Digitalmars-d-learn mailing list