Skip to content

Commit 303d9cd

Browse files
committed
Changes relating to post 4
1 parent 5d721fa commit 303d9cd

25 files changed

+649
-567
lines changed

ALL_BUILD.vcxproj

Lines changed: 0 additions & 175 deletions
This file was deleted.

ALL_BUILD.vcxproj.filters

Lines changed: 0 additions & 8 deletions
This file was deleted.

MySQLDotNet.def

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
LIBRARY MySQLDotNet
2+
VERSION 1.0
3+
EXPORTS
4+
mysqldotnet_int_deinit
5+
mysqldotnet_int_init
6+
mysqldotnet_int
7+
mysqldotnet_real_deinit
8+
mysqldotnet_real_init
9+
mysqldotnet_real
10+
mysqldotnet_string_deinit
11+
mysqldotnet_string_init
12+
mysqldotnet_string

ZERO_CHECK.vcxproj

Lines changed: 0 additions & 169 deletions
This file was deleted.

ZERO_CHECK.vcxproj.filters

Lines changed: 0 additions & 13 deletions
This file was deleted.

clr_host/ClrHost.cpp

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
#include "ClrHost.h"
33

4-
const wchar_t *CClrHost::AppDomainManagerAssembly = L"mysql_managed_interface, Version=1.0.0.0, PublicKeyToken=71c4a5d4270bd29c";
5-
const wchar_t *CClrHost::AppDomainManagerType = L"mysql_managed_interface.MySQLHostManager";
4+
const wchar_t *CClrHost::AppDomainManagerAssembly = L"MySQLHostManager, Version=1.0.0.0, PublicKeyToken=71c4a5d4270bd29c";
5+
const wchar_t *CClrHost::AppDomainManagerType = L"MySQLHostManager.MySQLHostManager";
66

77
bool g_CLRHasBeenLoaded = false;
88

@@ -286,15 +286,41 @@ STDMETHODIMP CClrHost::raw_GetManagedHost(long appDomain, BSTR clr, IManagedHost
286286
}
287287
}
288288

289+
STDMETHODIMP CClrHost::raw_GetSpecificManagedHost(BSTR clr, IManagedHost **ppHost)
290+
{
291+
_ASSERTE(m_started);
292+
293+
if (ppHost == NULL)
294+
return E_POINTER;
295+
296+
// get the AppDomainManager for the specified domain
297+
auto iHost = m_NewlyCreatedAppDomains[clr];
298+
299+
// see if we've got a host
300+
if (iHost == NULL)
301+
{
302+
*ppHost = NULL;
303+
return E_NOMANAGEDHOST;
304+
}
305+
else
306+
{
307+
*ppHost = iHost;
308+
(*ppHost)->AddRef();
309+
return S_OK;
310+
}
311+
}
312+
313+
289314
// IHostGCManager
290315
STDMETHODIMP CClrHost::SuspensionEnding(DWORD generation){ return S_OK; }
291316
STDMETHODIMP CClrHost::SuspensionStarting(){ return S_OK; }
292317
STDMETHODIMP CClrHost::ThreadIsBlockingForSuspension(){ return S_OK; }
293318

294-
std::wstring CClrHost::CreateAppDomainForQuery(std::string FnName)
319+
STDMETHODIMP CClrHost::raw_CreateAppDomainForQuery(BSTR FnName, BSTR *pRetVal)
295320
{
296321
IManagedHostPtr pAppMgr = this->GetDefaultManagedHost();
297-
_bstr_t retString = pAppMgr->CreateAppDomain(_bstr_t(FnName.c_str()));
298-
322+
IManagedHostPtr pNewDomain = pAppMgr->CreateAppDomain(FnName);
323+
*pRetVal = (BSTR)pNewDomain->GetAppDomainName;
324+
this->m_NewlyCreatedAppDomains[std::wstring(*pRetVal)] = pNewDomain;
299325
return S_OK;
300326
}

clr_host/ClrHost.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ATL_NO_VTABLE CClrHost : public CComObjectRootEx<CComSingleThreadModel>,
4545

4646
public:
4747
static HRESULT BindToRuntime(IUnmanagedHost **pHost);
48-
std::wstring CreateAppDomainForQuery(std::string FnName);
48+
4949

5050
// IHostControl
5151
public:
@@ -58,6 +58,8 @@ class ATL_NO_VTABLE CClrHost : public CComObjectRootEx<CComSingleThreadModel>,
5858
STDMETHODIMP raw_Stop();
5959
STDMETHODIMP get_DefaultManagedHost(IManagedHost **ppHost);
6060
STDMETHODIMP raw_GetManagedHost(long appDomain, BSTR clr, IManagedHost **ppHost);
61+
STDMETHODIMP raw_GetSpecificManagedHost(BSTR clr, IManagedHost **ppHost);
62+
STDMETHODIMP raw_CreateAppDomainForQuery(BSTR FnName, BSTR * pRetVal);
6163

6264
// IHostGCManager
6365
public:

clr_host/clr_host.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<GenerateDebugInformation>true</GenerateDebugInformation>
6565
</Link>
6666
<PreBuildEvent>
67-
<Command>"$(TargetFrameworkSDKToolsDirectory)TlbExp.exe" "$(SolutionDir)mysql_managed_interface\bin\$(Configuration)\mysql_managed_interface.dll" /out:"$(IntDir)mysql_managed_interface.tlb"</Command>
67+
<Command>"$(TargetFrameworkSDKToolsDirectory)TlbExp.exe" "$(SolutionDir)mysql_managed_interface\bin\$(Configuration)\MySQLHostManager.dll" /out:"$(IntDir)MySQLHostManager.tlb"</Command>
6868
</PreBuildEvent>
6969
</ItemDefinitionGroup>
7070
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

clr_host/stdafx.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@
2626
#include "resource.h"
2727
#include <iostream>
2828
#include <map>
29+
#include <string>
2930
#include <atlbase.h>
3031
#include <atlcom.h>
3132
#include <comdef.h>
3233
#include <tchar.h>
3334
#include <mscoree.h>
3435
#ifdef DEBUG
35-
#import "Debug/mysql_managed_interface.tlb" no_namespace
36+
#import "Debug/MySQLHostManager.tlb" no_namespace
3637
#else
37-
#import "Release/mysql_managed_interface.tlb" no_namespace
38+
#import "Release/MySQLHostManager.tlb" no_namespace
3839
#endif
3940

4041
#pragma warning (pop)

mysql_managed_interface/ICustomAssembly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Text;
44

5-
namespace mysql_managed_interface
5+
namespace MySQLHostManager
66
{
77
public interface ICustomAssembly
88
{

0 commit comments

Comments
 (0)