August 31, 2006
sorry my poor english. there are 3 bugs(questions):

1.
------------------------------------------------
export class CMyClass
{
public:
...
}
------------------------------------------------
this will not export any method in DLL.


2.
can dmd generate a "pure" header file? that is, no any code in generated .di
file.
----------------------
void test()
{
  int a = 0;
}
----------------------
this function will not changed in .di file

----------------------
void test()
{
  if ( .. )..;
  int a = 0;
}
----------------------
this function will become

void test();

this is right

3.
"dmd -release -O ..." works not fine, when compile dwt's ole_com example,
some useful code be "optimized out". code in oleclientsite.d:
protected GUID* getClassID(char[] clientName) {
	// create a GUID struct to hold the result
	GUID* guid = new GUID();

	// create a null terminated array of wchar
	wchar* buffer = null;
	if (clientName !is null) {
		buffer = Converter.StrToWCHARz(clientName);
	}
	if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){
		HRESULT result = COM.CLSIDFromString(buffer, guid);
		if (result != COM.S_OK)
			OLE.error(__FILE__, __LINE__,
OLE.ERROR_INVALID_CLASSID, result);
	}
	return guid;
}

-------------------------------------
	if (clientName !is null) {
		buffer = Converter.StrToWCHARz(clientName);
	}
---------------------------------------
this have optimizition error

but
-------------------------------------
	if (clientName != null) {
		buffer = Converter.StrToWCHARz(clientName);
	}
---------------------------------------
have not optimizition error
September 13, 2006
TVMAN schrieb am 2006-08-31:

<snip>

> 2.
> can dmd generate a "pure" header file? that is, no any code in generated .di
> file.
> ----------------------
> void test()
> {
>   int a = 0;
> }
> ----------------------
> this function will not changed in .di file
>
> ----------------------
> void test()
> {
>   if ( .. )..;
>   int a = 0;
> }
> ----------------------
> this function will become
>
> void test();
>
> this is right

This is a bug, please file file it at http://d.puremagic.com/issues/

> 3.
> "dmd -release -O ..." works not fine, when compile dwt's ole_com example,
> some useful code be "optimized out". code in oleclientsite.d:
> protected GUID* getClassID(char[] clientName) {
> 	// create a GUID struct to hold the result
> 	GUID* guid = new GUID();
>
> 	// create a null terminated array of wchar
> 	wchar* buffer = null;
> 	if (clientName !is null) {
> 		buffer = Converter.StrToWCHARz(clientName);
> 	}
> 	if (COM.CLSIDFromProgID(buffer, guid) != COM.S_OK){
> 		HRESULT result = COM.CLSIDFromString(buffer, guid);
> 		if (result != COM.S_OK)
> 			OLE.error(__FILE__, __LINE__,
> OLE.ERROR_INVALID_CLASSID, result);
> 	}
> 	return guid;
> }
>
> -------------------------------------
> 	if (clientName !is null) {
> 		buffer = Converter.StrToWCHARz(clientName);
> 	}
> ---------------------------------------
> this have optimizition error
>
> but
> -------------------------------------
> 	if (clientName != null) {
> 		buffer = Converter.StrToWCHARz(clientName);
> 	}
> ---------------------------------------
> have not optimizition error

What exactly is the optimizition error? (I'm not a Windows users.)

Please note that !is and != aren't synonyms:

#
# char[] clientName;
#
# if(clientName !is null){
#    writefln("!is");
# }
#
# if(clientName != null){
#    writefln("!=");
# }
#

Prints only "!is".

#
# char[] clientName = "ming";
#
# if(clientName !is null){
#    writefln("!is");
# }
#
# if(clientName != null){
#    writefln("!=");
# }
#

Prints "!is" and "!=".

Thomas