extern "C" 
{

	//------------------------------------------------------------------------------------
	// irr::io::IXMLWriter wrappers
	// be sure to call the del function when done
	//------------------------------------------------------------------------------------
	
	void IrrIO_IXMLWriter_del(IXMLWriter* f)
	{
		if (f)
			f->drop();
	}
	
	void IrrIO_IXMLWriter_writeClosingTag(IXMLWriter* f,const c8* name)
	{
		stringw w_text = name;
		if (f)
			f->writeClosingTag(w_text.c_str());
	}	
	
	void IrrIO_IXMLWriter_writeComment(IXMLWriter* f,const c8* comment)
	{
		stringw w_text = comment;
		if (f)
			f->writeComment(w_text.c_str());
	}	
	
	void IrrIO_IXMLWriter_writeElement(IXMLWriter* f,const c8* name,bool empty=false,const c8* attr1Name=0, const c8* attr1Value=0, const c8* attr2Name=0,const c8* attr2Value=0,const c8* attr3Name=0,const c8* attr3Value=0,const c8* attr4Name=0,const c8* attr4Value=0,const c8* attr5Name=0,const c8* attr5Value=0)
	{
		stringw w_text = name;
		stringw w_attr1Name = attr1Name;
		stringw w_attr1Value = attr1Value;
		stringw w_attr2Name = attr2Name;
		stringw w_attr2Value = attr2Value;
		stringw w_attr3Name = attr3Name;
		stringw w_attr3Value = attr3Value;
		stringw w_attr4Name = attr4Name;
		stringw w_attr4Value = attr4Value;
		stringw w_attr5Name = attr5Name;
		stringw w_attr5Value = attr5Value;
		
		if (f)
			f->writeElement(w_text.c_str(),empty,w_attr1Name.c_str(),w_attr1Value.c_str(),w_attr2Name.c_str(),w_attr2Value.c_str(),w_attr3Name.c_str(),w_attr3Value.c_str(),w_attr4Name.c_str(),w_attr4Value.c_str(),w_attr5Name.c_str(),w_attr5Value.c_str());
	}	
	
	void IrrIO_IXMLWriter_writeElementFromArray(IXMLWriter* f,const c8* name, bool empty,const c8** names,s32 namesCount,const c8** values,s32 valuesCount)
	{
		if (f) {
			stringw w_name = name;
			array<stringw> w_names(namesCount);
			array<stringw> w_values(valuesCount);
			
			for (int i=0; i<namesCount; i++) {	
				w_names[i]=names[i];
			}			

			for (int i=0; i<valuesCount; i++) {	
				w_values[i]=values[i];
			}			

			f->writeElement(w_name.c_str(),empty,w_names,w_values);
		}
	}
	
	void IrrIO_IXMLWriter_writeLineBreak(IXMLWriter* f)
	{
		if (f)
			f->writeLineBreak();
	}
	
	void IrrIO_IXMLWriter_writeText(IXMLWriter* f,const c8* text)
	{
		stringw w_text = text;
		if (f)
			f->writeText(w_text.c_str());
	}	
	
	void IrrIO_IXMLWriter_writeXMLHeader(IXMLWriter* f)
	{
		if (f)
			f->writeXMLHeader();
	}
	
	bool IrrIO_IXMLWriter_drop(IXMLWriter* unk)
	{
		if (unk)
			return unk->drop();
		else return 0;
	}
	
	const c8* IrrIO_IXMLWriter_getDebugName(IXMLWriter* unk)
	{
		if (unk)
			return unk->getDebugName();
		else return "";
	}
	
	void IrrIO_IXMLWriter_grab(IXMLWriter* unk)
	{
		if (unk)
			unk->grab();
	}

}
