add SingletonDll test do demonstrate the usage of singletons in a Dll
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@565 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
4fbed79847
commit
a3b09b5bed
12 changed files with 931 additions and 0 deletions
178
test/SingletonDll/Client.vcproj
Executable file
178
test/SingletonDll/Client.vcproj
Executable file
|
@ -0,0 +1,178 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="Client"
|
||||
ProjectGUID="{237F4D1A-6301-4656-8F34-B0F6496E929F}"
|
||||
RootNamespace="Client"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-wd4996"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="EXPLICIT_EXPORT;LOKI_STATIC;FOO_DLL;SINGLETONDLL_DLL;WIN32;_DEBUG;_CONSOLE _SECURE_SCL=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\..\bin\$(ProjectName).exe"
|
||||
GenerateDebugInformation="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\client.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
39
test/SingletonDll/SingletonDll.sln
Executable file
39
test/SingletonDll/SingletonDll.sln
Executable file
|
@ -0,0 +1,39 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client", "Client.vcproj", "{237F4D1A-6301-4656-8F34-B0F6496E929F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0DCBE03A-DAC7-4669-B29B-102D8F563736} = {0DCBE03A-DAC7-4669-B29B-102D8F563736}
|
||||
{42E13925-28CE-421B-993E-162510C90CD6} = {42E13925-28CE-421B-993E-162510C90CD6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foo", "foo.vcproj", "{42E13925-28CE-421B-993E-162510C90CD6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SingletonDll", "SingletonDll.vcproj", "{0DCBE03A-DAC7-4669-B29B-102D8F563736}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{42E13925-28CE-421B-993E-162510C90CD6} = {42E13925-28CE-421B-993E-162510C90CD6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{237F4D1A-6301-4656-8F34-B0F6496E929F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{237F4D1A-6301-4656-8F34-B0F6496E929F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{237F4D1A-6301-4656-8F34-B0F6496E929F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{237F4D1A-6301-4656-8F34-B0F6496E929F}.Release|Win32.Build.0 = Release|Win32
|
||||
{42E13925-28CE-421B-993E-162510C90CD6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{42E13925-28CE-421B-993E-162510C90CD6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{42E13925-28CE-421B-993E-162510C90CD6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{42E13925-28CE-421B-993E-162510C90CD6}.Release|Win32.Build.0 = Release|Win32
|
||||
{0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0DCBE03A-DAC7-4669-B29B-102D8F563736}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0DCBE03A-DAC7-4669-B29B-102D8F563736}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
223
test/SingletonDll/SingletonDll.vcproj
Executable file
223
test/SingletonDll/SingletonDll.vcproj
Executable file
|
@ -0,0 +1,223 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="SingletonDll"
|
||||
ProjectGUID="{0DCBE03A-DAC7-4669-B29B-102D8F563736}"
|
||||
RootNamespace="SingletonDll"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="Release\"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets=""
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -EHsc /wd4127 /wd4512"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="NDEBUG,_WINDOWS,WIN32,"
|
||||
GeneratePreprocessedFile="0"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
AssemblerListingLocation="Release\"
|
||||
ObjectFile="Release\"
|
||||
ProgramDataBaseFileName=".\"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="opengl32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib"
|
||||
OutputFile="Release\\SingletonDll.exe"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""
|
||||
IgnoreDefaultLibraryNames="msvcrt.lib"
|
||||
DelayLoadDLLs="comdlg32.dll,oleaut32.dll,winmm.dll,wsock32.dll,winspool.dll"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets=""
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -EHsc /wd4127 /wd4512 "
|
||||
Optimization="4"
|
||||
AdditionalIncludeDirectories="..\..\include;."
|
||||
PreprocessorDefinitions="EXPLICIT_EXPORT;LOKI_STATIC;FOO_DLL;SINGLETONDLL_MAKE_DLL;_WINDOWS;UNICODE;WIN32;_DEBUG"
|
||||
GeneratePreprocessedFile="0"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="false"
|
||||
FloatingPointExceptions="true"
|
||||
AssemblerListingLocation=""
|
||||
ProgramDataBaseFileName="$(IntDir)\vc80SingletonDll.pdb"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
DisableSpecificWarnings="4251"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\..\bin\$(ProjectName).dll"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="..\..\include\loki\Singleton.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\singletondll.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\singletondll.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\singletondll_export.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
25
test/SingletonDll/client.cpp
Executable file
25
test/SingletonDll/client.cpp
Executable file
|
@ -0,0 +1,25 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// $Header:
|
||||
|
||||
|
||||
#include "singletondll.h"
|
||||
#include "foo.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
Foo& foo = Singleton<Foo>::Instance();
|
||||
Foo& lokifoo = Loki::Singleton<Foo>::Instance();
|
||||
foo.foo();
|
||||
lokifoo.foo();
|
||||
}
|
25
test/SingletonDll/foo.cpp
Executable file
25
test/SingletonDll/foo.cpp
Executable file
|
@ -0,0 +1,25 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// $Header:
|
||||
|
||||
#include "foo.h"
|
||||
#include <iostream>
|
||||
|
||||
Foo::Foo()
|
||||
{
|
||||
}
|
||||
|
||||
void Foo::foo()
|
||||
{
|
||||
std::cout << "\nFoo:foo() called, this: " << this << "\n";
|
||||
}
|
30
test/SingletonDll/foo.h
Executable file
30
test/SingletonDll/foo.h
Executable file
|
@ -0,0 +1,30 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_FOO_H
|
||||
#define LOKI_FOO_H
|
||||
|
||||
// $Header:
|
||||
|
||||
#include "foo_export.h"
|
||||
|
||||
|
||||
|
||||
class FOO_EXPORT Foo
|
||||
{
|
||||
public:
|
||||
Foo();
|
||||
|
||||
void foo();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
219
test/SingletonDll/foo.vcproj
Executable file
219
test/SingletonDll/foo.vcproj
Executable file
|
@ -0,0 +1,219 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="Foo"
|
||||
ProjectGUID="{42E13925-28CE-421B-993E-162510C90CD6}"
|
||||
RootNamespace="Foo"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="."
|
||||
IntermediateDirectory="Release\"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets=""
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -EHsc /wd4127 /wd4512"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="NDEBUG,_WINDOWS,UNICODE,WIN32"
|
||||
GeneratePreprocessedFile="0"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
AssemblerListingLocation="Release\"
|
||||
ObjectFile="Release\"
|
||||
ProgramDataBaseFileName=".\"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
IgnoreImportLibrary="true"
|
||||
AdditionalDependencies="opengl32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib winmm.lib wsock32.lib winspool.lib delayimp.lib"
|
||||
OutputFile="Release\\Foo.exe"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""
|
||||
IgnoreDefaultLibraryNames="msvcrt.lib"
|
||||
DelayLoadDLLs="comdlg32.dll,oleaut32.dll,winmm.dll,wsock32.dll,winspool.dll"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=""
|
||||
SubSystem="2"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets=""
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
WarningLevel="0"
|
||||
DefaultCharType="0"
|
||||
EnableErrorChecks="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="-Zm200 -EHsc /wd4127 /wd4512 "
|
||||
Optimization="4"
|
||||
AdditionalIncludeDirectories=".;..\..\include"
|
||||
PreprocessorDefinitions="EXPLICIT_EXPORT;LOKI_STATIC;FOO_MAKE_DLL;_WINDOWS;UNICODE;WIN32;_DEBUG"
|
||||
GeneratePreprocessedFile="0"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="false"
|
||||
FloatingPointModel="0"
|
||||
AssemblerListingLocation=""
|
||||
ProgramDataBaseFileName="$(IntDir)\vc80foo.pdb"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
DisableSpecificWarnings="4251"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\..\bin\$(ProjectName).dll"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\foo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\foo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\foo_export.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
44
test/SingletonDll/foo_export.h
Executable file
44
test/SingletonDll/foo_export.h
Executable file
|
@ -0,0 +1,44 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FOO_FOO_EXPORT_H
|
||||
#define FOO_FOO_EXPORT_H
|
||||
|
||||
#include <loki/LokiExport.h>
|
||||
|
||||
#if (defined(FOO_MAKE_DLL) && defined(FOO_DLL)) || \
|
||||
(defined(FOO_MAKE_DLL) && defined(FOO_STATIC)) || \
|
||||
(defined(FOO_DLL) && defined(FOO_STATIC))
|
||||
#error export macro error: you could not build AND use the library
|
||||
#endif
|
||||
|
||||
#ifdef FOO_MAKE_DLL
|
||||
#define FOO_EXPORT LOKI_EXPORT_SPEC //__declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#ifdef FOO_DLL
|
||||
#define FOO_EXPORT LOKI_IMPORT_SPEC //__declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef FOO_STATIC
|
||||
#define FOO_EXPORT
|
||||
#endif
|
||||
|
||||
#if !defined(FOO_EXPORT) && !defined(EXPLICIT_EXPORT)
|
||||
#define FOO_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef FOO_EXPORT
|
||||
#error export macro error: FOO_EXPORT was not defined, disable EXPLICIT_EXPORT or define a export specification
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
24
test/SingletonDll/make.msvc.bat
Executable file
24
test/SingletonDll/make.msvc.bat
Executable file
|
@ -0,0 +1,24 @@
|
|||
|
||||
:: build Foo.dll
|
||||
|
||||
cl -c -DFOO_MAKE_DLL -Zm200 -O2 -DNDEBUG -MT -D_WINDLL -EHsc -GR -W4 -wd4251 -I"." -I"..\..\include" Foo.cpp
|
||||
link /NOLOGO /DLL /OUT:"Foo.dll" Foo.obj
|
||||
|
||||
|
||||
:: build SingletonDll.dll
|
||||
|
||||
cl -c -DSINGLETONDLL_MAKE_DLL -DFOO_DLL -Zm200 -O2 -DNDEBUG -MT -D_WINDLL -EHsc -GR -W4 -wd4251 -I"." -I"..\..\include" SingletonDll.cpp
|
||||
link /NOLOGO /DLL /OUT:"SingletonDll.dll" SingletonDll.obj foo.lib
|
||||
|
||||
|
||||
:: build Client.exe
|
||||
|
||||
cl -c -DSINGLETONDLL_DLL -DFOO_DLL -Zm200 -O2 -DNDEBUG -MT -D_WINDLL -EHsc -GR -W4 -wd4251 -I"." -I"..\..\include" client.cpp
|
||||
link /NOLOGO /SUBSYSTEM:CONSOLE /OUT:"Client.exe" Client.obj foo.lib SingletonDll.lib
|
||||
|
||||
|
||||
|
||||
del *.obj
|
||||
del *.lib
|
||||
del *.exp
|
||||
|
38
test/SingletonDll/singletondll.cpp
Executable file
38
test/SingletonDll/singletondll.cpp
Executable file
|
@ -0,0 +1,38 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// $Header:
|
||||
|
||||
#include <singletondll.h>
|
||||
|
||||
#include "foo.h"
|
||||
|
||||
|
||||
typedef Loki::SingletonHolder<Foo> FooSingleton;
|
||||
|
||||
|
||||
|
||||
Foo& Singleton<Foo>::Instance()
|
||||
{
|
||||
return FooSingleton::Instance();
|
||||
};
|
||||
|
||||
|
||||
LOKI_SINGLETON_INSTANCE_DEFINITION(FooSingleton)
|
||||
|
||||
/*
|
||||
Foo& Loki::Singleton<Foo>::Instance()
|
||||
{
|
||||
return FooSingleton::Instance();
|
||||
};
|
||||
*/
|
||||
|
42
test/SingletonDll/singletondll.h
Executable file
42
test/SingletonDll/singletondll.h
Executable file
|
@ -0,0 +1,42 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_SINGLETONDLL_H
|
||||
#define LOKI_SINGLETONDLL_H
|
||||
|
||||
// $Header:
|
||||
|
||||
#include "singletondll_export.h"
|
||||
|
||||
class Foo;
|
||||
|
||||
// Use the predefined Loki::Singleton
|
||||
// and export Loki::Singleton<Foo>
|
||||
#include <loki/Singleton.h>
|
||||
|
||||
template class SINGLETONDLL_EXPORT Loki::Singleton<Foo>;
|
||||
|
||||
|
||||
// declare the Singleton template by yourself
|
||||
// and export Singleton<Foo>
|
||||
// so the singleton is not in the Loki namespace
|
||||
template<class T>
|
||||
class Singleton
|
||||
{
|
||||
public:
|
||||
static T& Instance();
|
||||
};
|
||||
|
||||
template class SINGLETONDLL_EXPORT Singleton<Foo>;
|
||||
|
||||
|
||||
|
||||
#endif
|
44
test/SingletonDll/singletondll_export.h
Executable file
44
test/SingletonDll/singletondll_export.h
Executable file
|
@ -0,0 +1,44 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef SINGLETONDLL_SINGLETONDLL_EXPORT_H
|
||||
#define SINGLETONDLL_SINGLETONDLL_EXPORT_H
|
||||
|
||||
#include <loki/LokiExport.h>
|
||||
|
||||
#if (defined(SINGLETONDLL_MAKE_DLL) && defined(SINGLETONDLL_DLL)) || \
|
||||
(defined(SINGLETONDLL_MAKE_DLL) && defined(SINGLETONDLL_STATIC)) || \
|
||||
(defined(SINGLETONDLL_DLL) && defined(SINGLETONDLL_STATIC))
|
||||
#error export macro error: you could not build AND use the library
|
||||
#endif
|
||||
|
||||
#ifdef SINGLETONDLL_MAKE_DLL
|
||||
#define SINGLETONDLL_EXPORT LOKI_EXPORT_SPEC //__declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#ifdef SINGLETONDLL_DLL
|
||||
#define SINGLETONDLL_EXPORT LOKI_IMPORT_SPEC //__declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef SINGLETONDLL_STATIC
|
||||
#define SINGLETONDLL_EXPORT
|
||||
#endif
|
||||
|
||||
#if !defined(SINGLETONDLL_EXPORT) && !defined(EXPLICIT_EXPORT)
|
||||
#define SINGLETONDLL_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef SINGLETONDLL_EXPORT
|
||||
#error export macro error: SINGLETONDLL_EXPORT was not defined, disable EXPLICIT_EXPORT or define a export specification
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue