Index: trunk/abdev/BasicCompiler_Common/src/Class.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 370)
@@ -116,4 +116,8 @@
 	return classType == CClass::Interface;
 }
+bool CClass::IsComInterface() const
+{
+	return classType == CClass::ComInterface;
+}
 bool CClass::IsEnum() const
 {
@@ -241,8 +245,5 @@
 		}
 
-		if( pInheritsClass->IsInterface() ){
-			// インターフェイスはあとで継承する
-		}
-		else if( pInheritsClass->IsClass() ){
+		if( pInheritsClass->IsClass() ){
 			// クラスを継承する
 			isInheritsClass = true;
@@ -253,5 +254,5 @@
 		}
 		else{
-			SmoothieException::Throw(135,NULL,nowLine);
+			SetError(135,pInheritsClass->GetFullName().c_str(),nowLine);
 			return false;
 		}
@@ -268,47 +269,4 @@
 			return false;
 		}
-	}
-
-	i=0;
-	while( true ){
-
-		char temporary[VN_SIZE];
-		for( int i2=0;; i++, i2++ ){
-			if( inheritNames[i] == '\0' || inheritNames[i] == ',' ){
-				temporary[i2] = 0;
-				break;
-			}
-			temporary[i2] = inheritNames[i];
-		}
-
-		char className[VN_SIZE];
-		Jenga::Common::Strings typeParameters;
-		SplitGenericClassInstance( temporary, className, typeParameters );
-
-		//継承元クラスを取得
-		const CClass *pInheritsClass = compiler.GetObjectModule().meta.GetClasses().Find(className);
-		if( !pInheritsClass ){
-			SmoothieException::Throw(106,className,nowLine);
-			return false;
-		}
-
-		if( pInheritsClass->IsInterface() ){
-			// インターフェイスを継承する
-			if( !InheritsInterface( *pInheritsClass, nowLine ) ){
-				return false;
-			}
-		}
-		else if( pInheritsClass->IsClass() ){
-			// クラスはさっき継承した
-		}
-		else{
-			SmoothieException::Throw(135,NULL,nowLine);
-			return false;
-		}
-
-		if( inheritNames[i] == '\0' ){
-			break;
-		}
-		i++;
 	}
 
@@ -388,56 +346,16 @@
 	}
 
+	if( this->IsInterface() && inheritsClass.IsComInterface() )
+	{
+		// COMインターフェイスを継承した場合はCOMインターフェイスにする
+		this->SetClassType( CClass::ComInterface );
+	}
+
 	return true;
 }
-bool CClass::InheritsInterface( const CClass &inheritsInterface, int nowLine ){
-
-	//ループ継承でないかをチェック
-	if(pobj_LoopRefCheck->check(inheritsInterface)){
-		SmoothieException::Throw(123,inheritsInterface.GetName(),nowLine);
-		return false;
-	}
-
-	if( !inheritsInterface.IsReady() ){
-		//継承先が読み取られていないとき
-		pobj_LoopRefCheck->add(this->GetName().c_str());
-		compiler.GetObjectModule().meta.GetClasses().GetClass_recur(inheritsInterface.GetName().c_str());
-		pobj_LoopRefCheck->del(this->GetName().c_str());
-	}
-
-	//メソッドをコピー
-	BOOST_FOREACH( const CMethod *pBaseMethod, inheritsInterface.GetDynamicMethods() ){
-		CMethod *pMethod = new DynamicMethod( *pBaseMethod );
-
-		// アクセシビリティ
-		if(pBaseMethod->GetAccessibility() == Prototype::Private){
-			pMethod->SetAccessibility( Prototype::None );
-		}
-		else{
-			pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
-		}
-
-		//pobj_Inherits
-		// ※継承元のClassIndexをセット（入れ子継承を考慮する）
-		if(pBaseMethod->GetInheritsClassPtr()==0){
-			pMethod->SetInheritsClassPtr( &inheritsInterface );
-		}
-		else{
-			pMethod->SetInheritsClassPtr( pBaseMethod->GetInheritsClassPtr() );
-		}
-
-		GetDynamicMethods().push_back( pMethod );
-	}
-
-	//interfaces.push_back( Interface( &inheritsInterface, vtblNum ) );
-
-	//仮想関数の数
-	AddVtblNum( inheritsInterface.GetVtblNum() );
-
-	return true;
-}
 
 bool CClass::Implements( const CClass &interfaceClass, int nowLine )
 {
-	if( !interfaceClass.IsInterface() )
+	if( !interfaceClass.IsInterface() && !interfaceClass.IsComInterface() )
 	{
 		// インターフェイスではないとき
@@ -477,4 +395,5 @@
 	// キャストメソッドを追加（内部コードは自動生成すること）
 	/////////////////////////////////////////////////////////////////
+	if( interfaceClass.IsInterface() )
 	{
 		// Function Operator() As ITest
@@ -793,6 +712,6 @@
 	int i2;
 
-	//仮想関数が存在する場合は関数リストへのポインタのサイズを追加
-	int offset = IsExistVirtualFunctions() ? PTR_SIZE : 0;
+	//仮想関数が存在する場合はvtbl及びvtblMasterListへのポインタのサイズを追加
+	int offset = IsExistVirtualFunctions() ? PTR_SIZE*2 : 0;
 
 	int alignment = 1;
@@ -944,4 +863,8 @@
 	return 0;
 }
+long CClass::GetComVtblOffset() const
+{
+	return comVtblOffset;
+}
 long CClass::GetVtblMasterListOffset() const
 {
@@ -992,4 +915,13 @@
 
 		pInterface->SetVtblOffset( tempVtblOffset );
+
+		if( pInterface->GetClass().IsComInterface() )
+		{
+			if( this->comVtblOffset )
+			{
+				SetError();
+			}
+			this->comVtblOffset = tempVtblOffset;
+		}
 	}
 
@@ -1445,4 +1377,12 @@
 			pobj_c->SetConstructorMemberSubIndex( -1 );
 			pobj_c->SetDestructorMemberSubIndex( -1 );
+
+			if( memcmp( basbuf+i+1, "__COM", 5 ) == 0 && IsCommandDelimitation( basbuf[i+1+5] ) )
+			{
+				// COMインターフェイス
+				pobj_c->SetClassType( CClass::ComInterface );
+
+				i += 6;
+			}
 
 			if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){
Index: trunk/abdev/BasicCompiler_Common/src/Compiler.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 370)
@@ -36,6 +36,4 @@
 		if( !pGenericClass )
 		{
-			extern int cp;
-			SetError(106, className, cp );
 			return false;
 		}
Index: trunk/abdev/BasicCompiler_Common/src/DataTable.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 370)
@@ -84,6 +84,9 @@
 	this->lastMadeConstObjectDataTableOffset = dataTableOffset;
 
+	// com_vtblスケジュール
+	this->schedules.push_back( Schedule( Schedule::ComVtbl, &objClass, dataTableOffset ) );
+
 	// vtblスケジュール
-	this->schedules.push_back( Schedule( &objClass, dataTableOffset ) );
+	this->schedules.push_back( Schedule( Schedule::Vtbl, &objClass, dataTableOffset + PTR_SIZE ) );
 
 	// TypeInfoスケジュール
@@ -235,5 +238,6 @@
 
 	// スケジューリング
-	this->schedules.push_back( Schedule( &strClass, headOffset ) );
+	this->schedules.push_back( Schedule( Schedule::ComVtbl, &strClass, headOffset ) );
+	this->schedules.push_back( Schedule( Schedule::Vtbl, &strClass, headOffset + PTR_SIZE ) );
 	this->schedules.push_back( Schedule( Schedule::TypeInfo, &strClass, headOffset + offsetForTypeInfo ) );
 	this->schedules.push_back( Schedule( Schedule::DataTable, headOffset + offsetForChars ) );
Index: trunk/abdev/BasicCompiler_Common/src/Linker.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Linker.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/Linker.cpp	(revision 370)
@@ -165,4 +165,14 @@
 	BOOST_FOREACH( const Schedule &schedule, nativeCode.GetSchedules() )
 	{
+		if( schedule.GetType() == Schedule::ComVtbl )
+		{
+			LONG_PTR vtblOffset = schedule.GetClass().GetComVtblOffset();
+
+			nativeCode.Overwrite(
+				schedule.GetOffset(),
+				static_cast<long>( vtblOffset + imageBase + dataSectionBaseOffset )
+			);
+		}
+
 		if( schedule.GetType() == Schedule::Vtbl )
 		{
@@ -178,4 +188,21 @@
 	BOOST_FOREACH( const Schedule &schedule, dataTable.schedules )
 	{
+		if( schedule.GetType() == Schedule::ComVtbl )
+		{
+			LONG_PTR vtblOffset = schedule.GetClass().GetComVtblOffset();
+
+#ifdef _WIN64
+			dataTable.OverwriteInt64(
+				schedule.GetOffset(),
+				vtblOffset + imageBase + dataSectionBaseOffset
+			);
+#else
+			dataTable.Overwrite(
+				schedule.GetOffset(),
+				vtblOffset + imageBase + dataSectionBaseOffset
+			);
+#endif
+		}
+
 		if( schedule.GetType() == Schedule::Vtbl )
 		{
Index: trunk/abdev/BasicCompiler_Common/src/Method.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Method.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/Method.cpp	(revision 370)
@@ -155,5 +155,5 @@
 			if( !pMethod->GetUserProc().IsUsing() )
 			{
-				ts((char *)pMethod->GetUserProc().GetFullName().c_str());
+				//ts((char *)pMethod->GetUserProc().GetFullName().c_str());
 			}
 			pMethod->GetUserProc().Using();
Index: trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp	(revision 370)
@@ -95,7 +95,14 @@
 }
 
+void NativeCode::PutComVtblSchedule( const CClass *pClass )
+{
+	schedules.push_back( Schedule( Schedule::ComVtbl, pClass, GetSize() ) );
+
+	Put( (long)0 );
+}
+
 void NativeCode::PutVtblSchedule( const CClass *pClass )
 {
-	schedules.push_back( Schedule( pClass, GetSize() ) );
+	schedules.push_back( Schedule( Schedule::Vtbl, pClass, GetSize() ) );
 
 	Put( (long)0 );
Index: trunk/abdev/BasicCompiler_Common/src/Type.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Type.cpp	(revision 369)
+++ trunk/abdev/BasicCompiler_Common/src/Type.cpp	(revision 370)
@@ -452,4 +452,8 @@
 {
 	return ( IsObject() && GetClass().IsInterface() );
+}
+bool Type::IsComInterface() const
+{
+	return ( IsObject() && GetClass().IsComInterface() );
 }
 
