www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - cannot export whole class

reply TVMAN <faredu 163.com> writes:
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
Aug 31 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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: Prints only "!is". Prints "!is" and "!=". Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFCJRBLK5blCcjpWoRAjAwAJ9uvXWu5evH40/HbTgPtMIIMpWSdQCgodKx q3NigmkdKVZX4Y0jziQVqzs= =lhB2 -----END PGP SIGNATURE-----
Sep 13 2006