Beispiel #1
0
static ICompilerPtr NewCompiler()
{
	ICompilerPtr piCompiler;
	HRESULT hr = piCompiler.CreateInstance(__uuidof(DolphinCompiler));

	if (SUCCEEDED(hr))
		return piCompiler;

	if (hr == REGDB_E_CLASSNOTREG)
	{
		// Try and register it
		HINSTANCE hLib = LoadCompiler();
		if (hLib)
		{
			// It loaded, now try invoking the class factory entry point
			GETCLASSOBJPROC pfnFactory = (GETCLASSOBJPROC)::GetProcAddress(HMODULE(hLib), "DllGetClassObject");
			if (pfnFactory)
			{
				// Found the entry point, try retrieving the factory
				IClassFactoryPtr piFactory;
				hr = (*pfnFactory)(__uuidof(DolphinCompiler), IID_IClassFactory, (void**)&piFactory);

				if (SUCCEEDED(hr))
				{
					// Now try creating the VM object directly
					hr = piFactory->CreateInstance(NULL, __uuidof(ICompiler), (void**)&piCompiler);
				}
			}
		}
	}

	return piCompiler;
}
void CompilerMainPage::LoadCompilers()
{
    // Populate the compilers list
    m_listBoxCompilers->Clear();

    wxString cmpType;
    if(clCxxWorkspaceST::Get()->IsOpen() && clCxxWorkspaceST::Get()->GetActiveProject()) {
        BuildConfigPtr bldConf = clCxxWorkspaceST::Get()->GetActiveProject()->GetBuildConfiguration();
        if(bldConf) {
            cmpType = bldConf->GetCompilerType();
        }
    }

    BuildSettingsConfigCookie cookie;
    CompilerPtr cmp = BuildSettingsConfigST::Get()->GetFirstCompiler(cookie);
    int sel(0);
    while(cmp) {
        int curidx = m_listBoxCompilers->Append(cmp->GetName());
        if(!cmpType.IsEmpty() && (cmp->GetName() == cmpType)) {
            sel = curidx;
        }
        cmp = BuildSettingsConfigST::Get()->GetNextCompiler(cookie);
    }

    if(!m_listBoxCompilers->IsEmpty()) {
        m_listBoxCompilers->SetSelection(sel);
        LoadCompiler(m_listBoxCompilers->GetStringSelection());
    }
}
Beispiel #3
0
HLSLCompiler::HLSLCompiler() :
	hD3DCompilerDll(nullptr),
	PD3DCompile(nullptr),
	PD3DReflect(nullptr),
	d3dcompiler_dll_ref(0),
	m_AsyncCompiler()
{
	LoadCompiler();
	m_AsyncCompiler.SetCompilerFunction(PD3DCompile);
}
void CompilerMainPage::OnCompilerSelected(wxCommandEvent& event) { LoadCompiler(event.GetString()); }