Index: trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
===================================================================
--- trunk/abdev/BasicCompiler32/BasicCompiler.vcproj	(revision 287)
+++ trunk/abdev/BasicCompiler32/BasicCompiler.vcproj	(revision 288)
@@ -1252,4 +1252,20 @@
 					RelativePath="..\BasicCompiler_Common\src\BoostSerializationSupport.cpp"
 					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							UsePrecompiledHeader="0"
+						/>
+					</FileConfiguration>
 				</File>
 			</Filter>
Index: trunk/abdev/BasicCompiler32/Compile_Var.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler32/Compile_Var.cpp	(revision 288)
@@ -716,5 +716,4 @@
 
 bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){
-	extern BYTE *initGlobalBuf;
 	int i2,i3;
 	char temporary[VN_SIZE];
@@ -820,11 +819,24 @@
 
 	if( type.IsDouble() ){
-		*(double *)(initGlobalBuf+offset)=(double)dbl;
+		compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+			offset,
+			(const char *)&dbl,
+			sizeof(double)
+		);
 	}
 	else if( type.IsSingle() ){
-		*(float *)(initGlobalBuf+offset)=(float)dbl;
+		float flt = (float)dbl;
+		compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+			offset,
+			(const char *)&flt,
+			sizeof(float)
+		);
 	}
 	else if( type.Is64() ){
-		*(_int64 *)(initGlobalBuf+offset)=i64data;
+		compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+			offset,
+			(const char *)&i64data,
+			sizeof(_int64)
+		);
 	}
 	else if( type.IsLong() || type.IsDWord() || type.IsPointer() ){
@@ -844,12 +856,27 @@
 		}
 		else{
-			*(DWORD *)(initGlobalBuf+offset)=(DWORD)i64data;
+			long l = (long)i64data;
+			compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+				offset,
+				(const char *)&l,
+				sizeof(long)
+			);
 		}
 	}
 	else if( type.IsWord() || type.IsInteger() ){
-		*(WORD *)(initGlobalBuf+offset)=(WORD)i64data;
+		short s = (short)i64data;
+		compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+			offset,
+			(const char *)&s,
+			sizeof(short)
+		);
 	}
 	else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){
-		*(BYTE *)(initGlobalBuf+offset)=(BYTE)i64data;
+		char c = (char)i64data;
+		compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite(
+			offset,
+			(const char *)&c,
+			sizeof(char)
+		);
 	}
 
@@ -1093,5 +1120,5 @@
 				// 呼び出し側のオフセットズレを考慮する
 
-				if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE/*ret分*/ ) % alignment ){
+				if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
 					AllLocalVarSize += PTR_SIZE;
 				}
Index: trunk/abdev/BasicCompiler32/MakePeHdr.cpp
===================================================================
--- trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler32/MakePeHdr.cpp	(revision 288)
@@ -323,8 +323,4 @@
 
 
-	//グローバル変数の初期バッファ
-	extern BYTE *initGlobalBuf;
-	initGlobalBuf=(BYTE *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
-
 	//リロケーション情報
 	pobj_Reloc=new CReloc();
@@ -401,5 +397,6 @@
 		InitGCVariables();
 
-		if( compiler.IsStaticLibrary() ){
+		if( compiler.IsStaticLibrary() )
+		{
 			//_System_StartupProgramの呼び出し
 			compiler.codeGenerator.op_call(pSub_System_StartupProgram);
@@ -812,5 +809,5 @@
 			pVar->SetOffsetAddress(
 				(pVar->GetOffsetAddress()&0x7FFFFFFF)
-				+ compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()
+				+ compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()
 			);
 		}
@@ -885,14 +882,14 @@
 
 	//リライタブルセクションのファイル上のサイズ（グローバル変数の初期情報のみを格納）
-	if( compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize() % FILE_ALIGNMENT )
+	if( compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize() % FILE_ALIGNMENT )
 	{
 		FileSize_RWSection =
-			compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()
-			+ (FILE_ALIGNMENT-compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()%FILE_ALIGNMENT);
+			compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()
+			+ (FILE_ALIGNMENT-compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()%FILE_ALIGNMENT);
 	}
 	else{
-		if( compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize() )
+		if( compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize() )
 		{
-			FileSize_RWSection = compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize();
+			FileSize_RWSection = compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize();
 		}
 		else FileSize_RWSection=FILE_ALIGNMENT;
@@ -957,5 +954,5 @@
 
 	//リライタブルセクションのメモリ上のサイズ
-	i = compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()
+	i = compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()
 		+ compiler.GetObjectModule().meta.GetGlobalVars().GetAllSize();
 	if(i%MEM_ALIGNMENT) MemSize_RWSection=i+(MEM_ALIGNMENT-i%MEM_ALIGNMENT);
@@ -1344,5 +1341,5 @@
 	memset((char *)RWSectionHeader.Name,0,IMAGE_SIZEOF_SHORT_NAME);
 	lstrcpy((char *)RWSectionHeader.Name,".data");
-	RWSectionHeader.Misc.VirtualSize=			compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()
+	RWSectionHeader.Misc.VirtualSize=			compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()
 												+ compiler.GetObjectModule().meta.GetGlobalVars().GetAllSize();
 	RWSectionHeader.VirtualAddress=				MemPos_RWSection;
@@ -1564,10 +1561,16 @@
 	if(bUse_RWSection){
 		//リライタブル データ テーブル（グローバル変数の初期バッファ）
-		initGlobalBuf=(BYTE *)HeapReAlloc(hHeap,
-			HEAP_ZERO_MEMORY,
-			initGlobalBuf,
-			FileSize_RWSection);
-		WriteFile(hFile,initGlobalBuf,FileSize_RWSection,(DWORD *)&i2,NULL);
-		i+=i2;
+
+		char *temp = (char *)calloc( FileSize_RWSection, 1 );
+		memcpy(
+			temp,
+			compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetBuffer(),
+			compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize()
+		);
+
+		WriteFile(hFile,temp,FileSize_RWSection,(DWORD *)&i2,NULL);
+		i+=i2;
+
+		free( temp );
 	}
 
@@ -1644,7 +1647,4 @@
 	HeapDefaultFree(pHintTable);
 
-	//グローバル変数の初期バッファを解放
-	HeapDefaultFree(initGlobalBuf);
-
 	//リソースセクションバッファを解放
 	HeapDefaultFree(RSrcSectionBuffer);
Index: trunk/abdev/BasicCompiler32/stdafx.h
===================================================================
--- trunk/abdev/BasicCompiler32/stdafx.h	(revision 287)
+++ trunk/abdev/BasicCompiler32/stdafx.h	(revision 288)
@@ -18,2 +18,4 @@
 
 #include "../BasicCompiler_Common/common.h"
+
+#include <Compiler.h>
Index: trunk/abdev/BasicCompiler_Common/Compile.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/Compile.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/Compile.cpp	(revision 288)
@@ -19,7 +19,4 @@
 
 #include <Exception.h>
-
-//グローバル変数初期バッファ
-BYTE *initGlobalBuf;
 
 //With情報
Index: trunk/abdev/BasicCompiler_Common/Debug.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/Debug.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/Debug.cpp	(revision 288)
@@ -337,5 +337,8 @@
 		WriteProcessMemory(hDebugProcess,
 			(void *)(ULONG_PTR)(pobj_DBDebugSection->ppobj_ds[i]->dwImageBase + pobj_DBDebugSection->ppobj_ds[i]->dwRVA_RWSection),
-			_DebugSys_dwThreadID,sizeof(DWORD)*MAX_DEBUG_THREAD,&lpAccBytes);
+			_DebugSys_dwThreadID,
+			sizeof(DWORD)*MAX_DEBUG_THREAD,
+			&lpAccBytes
+		);
 	}
 }
Index: trunk/abdev/BasicCompiler_Common/VariableOpe.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 288)
@@ -1008,13 +1008,4 @@
 		int result = 0;
 		if( !pVar->GetType().IsObject() ){
-			//初期バッファにデータをセット
-			extern BYTE *initGlobalBuf;
-			initGlobalBuf = (BYTE *)HeapReAlloc(
-				hHeap,
-				HEAP_ZERO_MEMORY,
-				initGlobalBuf,
-				compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize()
-			);
-
 			result = SetInitGlobalData(pVar->GetOffsetAddress(),
 				pVar->GetType(),
Index: trunk/abdev/BasicCompiler_Common/common.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/common.h	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/common.h	(revision 288)
@@ -47,9 +47,11 @@
 
 #ifdef _AMD64_
-#define PLATFORM	64
+	#define PLATFORM	64
 #else
 #define PLATFORM	32
-typedef long LONG_PTR;
-typedef DWORD ULONG_PTR;
+	#ifndef LONG_PTR
+		typedef long LONG_PTR;
+		typedef DWORD ULONG_PTR;
+	#endif
 #endif
 
Index: trunk/abdev/BasicCompiler_Common/include/Binary.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/include/Binary.h	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/include/Binary.h	(revision 288)
@@ -61,4 +61,7 @@
 			}
 			buffer = (char *)realloc( buffer, allocateSize );
+
+			// 再確保した部分を0で埋める
+			memset( buffer + size, 0, allocateSize - size );
 		}
 	}
@@ -96,4 +99,9 @@
 		return size;
 	}
+	void Resize( int newSize )
+	{
+		Realloc( newSize );
+		size = newSize;
+	}
 
 	long GetLong( int pos ) const
@@ -102,4 +110,8 @@
 	}
 
+	void Overwrite( int pos, const char *buffer, int size )
+	{
+		memcpy( this->buffer + pos, buffer, size );
+	}
 	void Overwrite( int pos, char c )
 	{
@@ -117,4 +129,12 @@
 		memcpy( this->buffer + this->size, buffer, size );
 		this->size += size;
+	}
+	void Put( double dbl )
+	{
+		Put( (const char *)(&dbl), sizeof(double) );
+	}
+	void Put( float flt )
+	{
+		Put( (const char *)(&flt), sizeof(float) );
 	}
 	void Put( _int64 i64data )
Index: trunk/abdev/BasicCompiler_Common/include/Meta.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/include/Meta.h	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/include/Meta.h	(revision 288)
@@ -26,5 +26,5 @@
 
 	// グローバル変数
-	Variables globalVars;
+	GlobalVars globalVars;
 
 	// グローバル定数
@@ -113,9 +113,9 @@
 	}
 
-	const Variables &GetGlobalVars() const
+	const GlobalVars &GetGlobalVars() const
 	{
 		return globalVars;
 	}
-	Variables &GetGlobalVars()
+	GlobalVars &GetGlobalVars()
 	{
 		return globalVars;
Index: trunk/abdev/BasicCompiler_Common/include/Variable.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/include/Variable.h	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/include/Variable.h	(revision 288)
@@ -5,4 +5,5 @@
 #include <Symbol.h>
 #include <Type.h>
+#include <Binary.h>
 
 class Variable : public Symbol
@@ -223,46 +224,6 @@
 class Variables : public vector<Variable *>
 {
+protected:
 	int allSize;
-	int allInitSize;
-public:
-	Variables()
-		: allSize( 0 )
-		, allInitSize( 0 )
-	{
-	}
-	~Variables(){
-		Clear();
-	}
-
-	void Clear(){
-		for( int i=0; i<(int)this->size(); i++ ){
-			delete (*this)[i];
-		}
-
-		allSize = 0;
-		allInitSize = 0;
-		clear();
-	}
-	void PullOutAll()
-	{
-		clear();
-	}
-
-	bool DuplicateCheck( const Symbol &symbol ) const;
-
-	const Variable *BackSearch( const Symbol &symbol ) const;
-	const Variable *Find( const Symbol &symbol )const;
-
-	void Add( Variable *pVar, bool isResetOffsetAddress = true );
-
-	int GetAllSize() const
-	{
-		return allSize;
-	}
-	int GetAllInitSize() const
-	{
-		return allInitSize;
-	}
-
 
 	// XMLシリアライズ用
@@ -275,17 +236,61 @@
 		ar & boost::serialization::make_nvp("vector_Variable", boost::serialization::base_object<vector<Variable *>>(*this));
 	}
+
+public:
+	Variables()
+		: allSize( 0 )
+	{
+	}
+	~Variables(){
+		Clear();
+	}
+
+	void Clear(){
+		for( int i=0; i<(int)this->size(); i++ ){
+			delete (*this)[i];
+		}
+
+		allSize = 0;
+		clear();
+	}
+	void PullOutAll()
+	{
+		clear();
+	}
+
+	int GetAllSize() const
+	{
+		return allSize;
+	}
+
+	bool DuplicateCheck( const Symbol &symbol ) const;
+
+	const Variable *BackSearch( const Symbol &symbol ) const;
+	const Variable *Find( const Symbol &symbol )const;
 };
 
-class GlobalVar : public Variable
+class GlobalVars : public Variables
 {
-	BYTE *initBuffer;
-public:
-	GlobalVar()
-	{
-		initBuffer = (BYTE *)malloc( 1 );
-	}
-	~GlobalVar()
-	{
-		free( initBuffer );
-	}
+public:
+	Binary initAreaBuffer;
+
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		trace_for_serialize( "serializing - GlobalVars" );
+
+		ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Variables );
+		ar & BOOST_SERIALIZATION_NVP( initAreaBuffer );
+	}
+public:
+	GlobalVars()
+	{
+	}
+	~GlobalVars()
+	{
+	}
+
+	void Add( Variable *pVar, bool isResetOffsetAddress = true );
 };
Index: trunk/abdev/BasicCompiler_Common/include/option.h
===================================================================
--- trunk/abdev/BasicCompiler_Common/include/option.h	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/include/option.h	(revision 288)
@@ -37,5 +37,5 @@
 
 	// XMLシリアライズに関するログを生成する
-	//#define USE_TRACE_FOR_SERIALIZE
+	#define USE_TRACE_FOR_SERIALIZE
 
 	// ソースコードステップに関するログを生成する
Index: trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp	(revision 288)
@@ -1,3 +1,19 @@
-#include "stdafx.h"
+#include <string>
+#include <vector>
+#include <fstream>
+
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <commctrl.h>
+#include <time.h>
+#include <limits.h>
+#include <shlobj.h>
+
+//boost libraries
+#include <boost/foreach.hpp>
+
+#include "../common.h"
 
 #include <boost/archive/xml_oarchive.hpp>
@@ -16,6 +32,5 @@
 
 #include <BoostSerializationSupport.h>
-
-#include <windows.h>
+#include <Compiler.h>
 
 using namespace Jenga::Common;
Index: trunk/abdev/BasicCompiler_Common/src/LexicalScope.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/LexicalScope.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/src/LexicalScope.cpp	(revision 288)
@@ -71,10 +71,10 @@
 	CallDestructorsOfScopeEnd();
 
-	Variables &vars = UserProc::IsGlobalAreaCompiling() ?
-		compiler.GetObjectModule().meta.GetGlobalVars() :
-		UserProc::CompilingUserProc().GetLocalVars();
+	Variables *pVars = UserProc::IsGlobalAreaCompiling() ?
+		&compiler.GetObjectModule().meta.GetGlobalVars() :
+		&UserProc::CompilingUserProc().GetLocalVars();
 
 	//使用済みローカル変数の生存チェックを外す
-	BOOST_FOREACH( Variable *pVar, vars ){
+	BOOST_FOREACH( Variable *pVar, (*pVars) ){
 		if(pVar->bLiving&&pVar->GetScopeLevel()==level){
 			pVar->bLiving=0;
@@ -96,14 +96,14 @@
 void LexicalScopes::CallDestructorsOfScopeEnd(){
 
-	Variables &vars = UserProc::IsGlobalAreaCompiling() ?
-		compiler.GetObjectModule().meta.GetGlobalVars() :
-		UserProc::CompilingUserProc().GetLocalVars();
+	Variables *pVariabls = UserProc::IsGlobalAreaCompiling() ?
+		&compiler.GetObjectModule().meta.GetGlobalVars() :
+		&UserProc::CompilingUserProc().GetLocalVars();
 
 
 	int i3;
 	int indexSystemGC=-1;
-	for( i3 = (int)vars.size() - 1; i3 >= 0; i3-- ){		//確保したのと逆順序で解放するため、バックサーチにする
+	for( i3 = (int)pVariabls->size() - 1; i3 >= 0; i3-- ){		//確保したのと逆順序で解放するため、バックサーチにする
 
-		Variable *pVar = vars[i3];
+		Variable *pVar = (*pVariabls)[i3];
 
 		if( UserProc::IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
@@ -159,7 +159,7 @@
 	if(indexSystemGC!=-1){
 		//_System_GCオブジェクトのデストラクタの呼び出し処理
-		const CMethod *method = vars[indexSystemGC]->GetType().GetClass().GetDestructorMethod();
+		const CMethod *method = (*pVariabls)[indexSystemGC]->GetType().GetClass().GetDestructorMethod();
 		if( method ){
-			Opcode_CallProc("",&method->GetUserProc(),0,vars[indexSystemGC]->GetName().c_str(),DEF_OBJECT);
+			Opcode_CallProc("",&method->GetUserProc(),0,(*pVariabls)[indexSystemGC]->GetName().c_str(),DEF_OBJECT);
 		}
 	}
Index: trunk/abdev/BasicCompiler_Common/src/Linker.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Linker.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/src/Linker.cpp	(revision 288)
@@ -78,5 +78,5 @@
 void Linker::ResolveGlobalVarSchedules( long rwSectionBaseOffset )
 {
-	int allInitVarSize = compiler.GetObjectModule().meta.GetGlobalVars().GetAllInitSize();
+	int allInitVarSize = compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.GetSize();
 
 	BOOST_FOREACH( const Schedule &schedule, nativeCode.GetSchedules() )
Index: trunk/abdev/BasicCompiler_Common/src/Meta.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Meta.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/src/Meta.cpp	(revision 288)
@@ -82,4 +82,5 @@
 
 	// グローバル変数
+	long initAreaBaseOffset = this->globalVars.initAreaBuffer.GetSize();
 	BOOST_FOREACH( Variable *pVar, meta.globalVars )
 	{
@@ -94,5 +95,5 @@
 		{
 			// 初期バッファがあるときはデータテーブルオフセットを適用する
-			pVar->SetOffsetAddress( pVar->GetOffsetAddress() + dataSectionBaseOffset );
+			pVar->SetOffsetAddress( pVar->GetOffsetAddress() + initAreaBaseOffset );
 
 			isResetOffsetAddress = false;
@@ -103,4 +104,8 @@
 	}
 	meta.globalVars.PullOutAll();
+	this->globalVars.initAreaBuffer.Put(
+		meta.globalVars.initAreaBuffer.GetBuffer(),
+		meta.globalVars.initAreaBuffer.GetSize()
+	);
 
 	// グローバル定数
Index: trunk/abdev/BasicCompiler_Common/src/Variable.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Variable.cpp	(revision 287)
+++ trunk/abdev/BasicCompiler_Common/src/Variable.cpp	(revision 288)
@@ -33,10 +33,10 @@
 	//レキシカルスコープを考慮して重複判定
 	for( int i=(int)this->size()-1; i>=0 ; i-- ){
-		Variable &var = *(*this)[i];
-		if( var.bLiving											//現在のスコープで有効なもの
-			&& var.GetScopeLevel() == compiler.codeGenerator.lexicalScopes.GetNowLevel()	//現在のスコープと同一レベル
+		const Variable *pVar = (*this)[i];
+		if( pVar->bLiving											//現在のスコープで有効なもの
+			&& pVar->GetScopeLevel() == compiler.codeGenerator.lexicalScopes.GetNowLevel()	//現在のスコープと同一レベル
 			)
 		{
-			if( var.IsEqualSymbol( symbol ) ){
+			if( pVar->IsEqualSymbol( symbol ) ){
 				return true;
 			}
@@ -50,10 +50,10 @@
 	//レキシカルスコープを考慮してバックサーチ
 	for( int i=(int)this->size()-1; i>=0 ; i-- ){
-		Variable &var = *(*this)[i];
-		if( var.bLiving											//現在のスコープで有効なもの
-			&& var.GetScopeLevel() <= compiler.codeGenerator.lexicalScopes.GetNowLevel()	//現在のスコープレベルを超さないもの（Returnによる解放処理中を考慮）
+		const Variable *pVar = (*this)[i];
+		if( pVar->bLiving											//現在のスコープで有効なもの
+			&& pVar->GetScopeLevel() <= compiler.codeGenerator.lexicalScopes.GetNowLevel()	//現在のスコープレベルを超さないもの（Returnによる解放処理中を考慮）
 			){
-				if( var.IsEqualSymbol( symbol ) ){
-					return &var;
+				if( pVar->IsEqualSymbol( symbol ) ){
+					return pVar;
 				}
 		}
@@ -74,5 +74,5 @@
 }
 
-void Variables::Add( Variable *pVar, bool isResetOffsetAddress )
+void GlobalVars::Add( Variable *pVar, bool isResetOffsetAddress )
 {
 	int alignment = 0;
@@ -84,15 +84,16 @@
 		//初期バッファがあるとき
 
-		if( alignment ){
-			if( allInitSize % alignment ){
-				allInitSize += alignment - (allInitSize % alignment);
-			}
-		}
-
 		if( isResetOffsetAddress )
 		{
-			pVar->SetOffsetAddress( allInitSize );
+			if( alignment ){
+				if( initAreaBuffer.GetSize() % alignment ){
+					initAreaBuffer.Resize( initAreaBuffer.GetSize() + ( alignment - (initAreaBuffer.GetSize() % alignment) ) );
+				}
+			}
+
+			pVar->SetOffsetAddress( initAreaBuffer.GetSize() );
+
+			initAreaBuffer.Resize( initAreaBuffer.GetSize() + pVar->GetMemorySize() );
 		}
-		allInitSize += pVar->GetMemorySize();
 	}
 	else{
@@ -105,9 +106,4 @@
 		}
 
-		if( !isResetOffsetAddress )
-		{
-			Jenga::Throw( "[Variables::Add] 初期バッファがない変数に対してisResetOffsetAddressをfalseにできない" );
-		}
-
 		pVar->SetOffsetAddress( allSize | 0x80000000 );
 		allSize += pVar->GetMemorySize();
Index: trunk/abdev/abcompiler32.sln
===================================================================
--- trunk/abdev/abcompiler32.sln	(revision 287)
+++ trunk/abdev/abcompiler32.sln	(revision 288)
@@ -5,4 +5,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BasicCompiler32", "BasicCompiler32\BasicCompiler.vcproj", "{11F0E9AB-EAEC-4616-A9DD-838073342CBB}"
+	ProjectSection(ProjectDependencies) = postProject
+		{996D6B55-6503-4427-84AB-351784EAFB71} = {996D6B55-6503-4427-84AB-351784EAFB71}
+		{F01805B6-65B4-4708-88F4-A5E07DEA9FBD} = {F01805B6-65B4-4708-88F4-A5E07DEA9FBD}
+	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smoothie", "..\jenga\projects\smoothie\smoothie.vcproj", "{996D6B55-6503-4427-84AB-351784EAFB71}"
