diff --git a/samples/example_app/uc2.cpp b/samples/example_app/uc2.cpp index 259a2c6ac3..7486ee51e2 100644 --- a/samples/example_app/uc2.cpp +++ b/samples/example_app/uc2.cpp @@ -51,16 +51,15 @@ #include #endif -#include "zlib.h" #include "str_util.h" #include "util.h" #include "filesys.h" #include "boinc_api.h" #include "mfile.h" #include "graphics2.h" +#include "uc2.h" #ifdef APP_GRAPHICS -#include "uc2.h" UC_SHMEM* shmem; #endif @@ -166,8 +165,9 @@ int main(int argc, char **argv) { exit(retval); } - fprintf(stderr, "%s app started; CPU time %f, flags:%s%s%s%s%s%s\n", + fprintf(stderr, "%s app started; %s; CPU time %f, flags:%s%s%s%s%s%s\n", boinc_msg_prefix(buf, sizeof(buf)), + uc2_dll_version(), cpu_time, early_exit?" early_exit":"", early_crash?" early_crash":"", diff --git a/samples/example_app/uc2.h b/samples/example_app/uc2.h index d36061793a..2bc9d3c67a 100644 --- a/samples/example_app/uc2.h +++ b/samples/example_app/uc2.h @@ -27,3 +27,13 @@ struct UC_SHMEM { // main program decrements it once/sec. // If it's zero, don't bother updating shmem }; + +#ifdef _WIN32 + +extern "C" { + +__declspec( dllimport ) char* uc2_dll_version(); + +}; + +#endif diff --git a/samples/example_app/uc2_dll.cpp b/samples/example_app/uc2_dll.cpp new file mode 100644 index 0000000000..6fee9014f4 --- /dev/null +++ b/samples/example_app/uc2_dll.cpp @@ -0,0 +1,62 @@ +// This file is part of BOINC. +// http://boinc.berkeley.edu +// Copyright (C) 2008 University of California +// +// BOINC is free software; you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// BOINC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with BOINC. If not, see . + +#ifdef _WIN32 +#include "boinc_win.h" +#else +#include "config.h" +#endif + +#ifdef _WIN32 + +extern "C" { + + __declspec( dllexport ) BOOL WINAPI DllMain( + HINSTANCE /*hinstDLL*/, // handle to DLL module + DWORD fdwReason, // reason for calling function + LPVOID /*lpReserved*/ // reserved + ){ + // Perform actions based on the reason for calling. + switch( fdwReason ) + { + case DLL_PROCESS_ATTACH: + // Initialize once for each new process. + // Return FALSE to fail DLL load. + break; + + case DLL_THREAD_ATTACH: + // Do thread-specific initialization. + break; + + case DLL_THREAD_DETACH: + // Do thread-specific cleanup. + break; + + case DLL_PROCESS_DETACH: + // Perform any necessary cleanup. + break; + } + return TRUE; // Successful DLL_PROCESS_ATTACH. + } + + __declspec( dllexport ) char* __cdecl uc2_dll_version() { + return "example app DLL v1.0"; + } + +} + +#endif \ No newline at end of file diff --git a/win_build/boinc.sln b/win_build/boinc.sln index c4dc2b34a1..377afc15cc 100644 --- a/win_build/boinc.sln +++ b/win_build/boinc.sln @@ -27,6 +27,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "worker", "worker.vcxproj", "{F1BE6109-586D-448E-8C5B-D5C2CB874EA2}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_app", "uc2.vcxproj", "{CCB9A37C-7AD8-4FC1-ABEC-1A6ED2268F83}" + ProjectSection(ProjectDependencies) = postProject + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD} = {B275C525-5EF4-40BA-A70A-4E01A76A0CDD} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_app_graphics", "uc2_graphics.vcxproj", "{3CF31288-A44D-4C78-A3AA-B05B6E32DF11}" EndProject @@ -64,6 +67,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_boinczip", "test_boinc EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_boinczip_zlib_conflicts", "test_boinc_zip_zlib_conflicts.vcxproj", "{0DCD2FE4-0604-4307-ABAA-C61F0065D717}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_app_dll", "uc2_dll.vcxproj", "{B275C525-5EF4-40BA-A70A-4E01A76A0CDD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -550,6 +555,22 @@ Global {0DCD2FE4-0604-4307-ABAA-C61F0065D717}.EmuRelease|x64.ActiveCfg = Release|x64 {0DCD2FE4-0604-4307-ABAA-C61F0065D717}.Release|Win32.ActiveCfg = Release|Win32 {0DCD2FE4-0604-4307-ABAA-C61F0065D717}.Release|x64.ActiveCfg = Release|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Debug|Win32.ActiveCfg = Debug|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Debug|Win32.Build.0 = Debug|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Debug|x64.ActiveCfg = Debug|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Debug|x64.Build.0 = Debug|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuDebug|Win32.ActiveCfg = Debug|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuDebug|Win32.Build.0 = Debug|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuDebug|x64.ActiveCfg = Debug|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuDebug|x64.Build.0 = Debug|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuRelease|Win32.ActiveCfg = Release|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuRelease|Win32.Build.0 = Release|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuRelease|x64.ActiveCfg = Release|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.EmuRelease|x64.Build.0 = Release|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Release|Win32.ActiveCfg = Release|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Release|Win32.Build.0 = Release|Win32 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Release|x64.ActiveCfg = Release|x64 + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/win_build/boincmgr.vcxproj b/win_build/boincmgr.vcxproj index 3052acfdf5..a9ba30319f 100644 --- a/win_build/boincmgr.vcxproj +++ b/win_build/boincmgr.vcxproj @@ -290,80 +290,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/win_build/uc2.vcxproj b/win_build/uc2.vcxproj index a1a90ccda0..50c51c0d5b 100644 --- a/win_build/uc2.vcxproj +++ b/win_build/uc2.vcxproj @@ -127,7 +127,7 @@ 0x0409 - opengl32.lib;glu32.lib;odbc32.lib;odbccp32.lib;psapi.lib;libcmt.lib;libcpmt.lib;zlib1.lib;%(AdditionalDependencies) + opengl32.lib;glu32.lib;odbc32.lib;odbccp32.lib;psapi.lib;libcmt.lib;libcpmt.lib;example_app_dll.lib;%(AdditionalDependencies) .\Build\$(Platform)\$(Configuration)\$(ProjectName).exe true true @@ -136,7 +136,7 @@ .\Build\$(Platform)\$(Configuration)\$(ProjectName).pdb Windows MachineX86 - ../../boinc_depends_win_vs2010/zlib/mswin/$(Platform)/$(Configuration)/lib + $(OutDir) @@ -177,7 +177,7 @@ 0x0409 - opengl32.lib;glu32.lib;odbc32.lib;odbccp32.lib;psapi.lib;libcmt.lib;libcpmt.lib;zlib1.lib;%(AdditionalDependencies) + opengl32.lib;glu32.lib;odbc32.lib;odbccp32.lib;psapi.lib;libcmt.lib;libcpmt.lib;example_app_dll.lib;%(AdditionalDependencies) .\Build\$(Platform)\$(Configuration)\$(ProjectName).exe true true @@ -186,7 +186,7 @@ .\Build\$(Platform)\$(Configuration)\$(ProjectName).pdb Windows MachineX64 - ../../boinc_depends_win_vs2010/zlib/mswin/$(Platform)/$(Configuration)/lib + $(OutDir) @@ -225,7 +225,7 @@ 0x0409 - libcmtd.lib;libcpmtd.lib;kernel32.lib;user32.lib;ole32.lib;psapi.lib;delayimp.lib;%(AdditionalDependencies) + libcmtd.lib;libcpmtd.lib;example_app_dll.lib;kernel32.lib;user32.lib;ole32.lib;psapi.lib;delayimp.lib;%(AdditionalDependencies) .\Build\$(Platform)\$(Configuration)\$(ProjectName).exe true true @@ -234,8 +234,7 @@ .\Build\$(Platform)\$(Configuration)\$(ProjectName).pdb Windows MachineX86 - - + $(OutDir) @@ -272,7 +271,7 @@ 0x0409 - libcmtd.lib;libcpmtd.lib;zlib1d.lib;kernel32.lib;user32.lib;gdi32.lib;opengl32.lib;glu32.lib;ole32.lib;psapi.lib;delayimp.lib;%(AdditionalDependencies) + libcmtd.lib;libcpmtd.lib;example_app_dll.lib;kernel32.lib;user32.lib;gdi32.lib;opengl32.lib;glu32.lib;ole32.lib;psapi.lib;delayimp.lib;%(AdditionalDependencies) .\Build\$(Platform)\$(Configuration)\$(ProjectName).exe true true @@ -281,7 +280,7 @@ .\Build\$(Platform)\$(Configuration)\$(ProjectName).pdb Windows MachineX64 - ../../boinc_depends_win_vs2010/zlib/mswin/$(Platform)/$(Configuration)/lib + $(OutDir) diff --git a/win_build/uc2_dll.vcxproj b/win_build/uc2_dll.vcxproj new file mode 100644 index 0000000000..148b50e7db --- /dev/null +++ b/win_build/uc2_dll.vcxproj @@ -0,0 +1,202 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + {B275C525-5EF4-40BA-A70A-4E01A76A0CDD} + Win32Proj + example_app_dll + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + .\Build\$(Platform)\$(Configuration)\ + .\Build\$(Platform)\$(Configuration)\$(ProjectName)\obj\ + .\Build\$(Platform)\$(Configuration)\ + .\Build\$(Platform)\$(Configuration)\$(ProjectName)\obj\ + .\Build\$(Platform)\$(Configuration)\ + .\Build\$(Platform)\$(Configuration)\$(ProjectName)\obj\ + .\Build\$(Platform)\$(Configuration)\ + .\Build\$(Platform)\$(Configuration)\$(ProjectName)\obj\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..;../win_build;../lib;../api;../../boinc_depends_win_vs2010/openssl/include;../coprocs/cuda/include;../coprocs/OpenCL/include;%(AdditionalIncludeDirectories) + _WIN32;WIN32;_MT;_DEBUG;_LIB_WIN32;_WINDOWS;_CONSOLE;CLIENT;BOINC_APP_GRAPHICS;%(PreprocessorDefinitions) + false + Async + EnableFastChecks + MultiThreadedDebug + Fast + NotUsing + boinc_win.h + $(IntDir)$(TargetName).pch + + + Level4 + ProgramDatabase + CompileAsCpp + + + boinc_win.h;%(ForcedIncludeFiles) + false + + + .\Build\$(Platform)\$(Configuration)\libboinc_staticcrt.lib + ../openssl/win32/x86/lib;%(AdditionalLibraryDirectories) + + + + + X64 + + + Disabled + ..;../win_build;../lib;../api;../../boinc_depends_win_vs2010/openssl/include;../coprocs/cuda/include;../coprocs/OpenCL/include;%(AdditionalIncludeDirectories) + _WIN32;WIN32;_MT;_DEBUG;_LIB_WIN32;_WINDOWS;_CONSOLE;CLIENT;BOINC_APP_GRAPHICS;%(PreprocessorDefinitions) + false + Async + EnableFastChecks + MultiThreadedDebug + Fast + NotUsing + boinc_win.h + $(IntDir)$(TargetName).pch + + + Level4 + ProgramDatabase + CompileAsCpp + + + boinc_win.h;%(ForcedIncludeFiles) + false + + + .\Build\$(Platform)\$(Configuration)\libboinc_staticcrt.lib + ../openssl/win32/x86/lib;%(AdditionalLibraryDirectories) + + + + + ..;../win_build;../lib;../api;../../boinc_depends_win_vs2010/openssl/include;../coprocs/cuda/include;../coprocs/OpenCL/include;%(AdditionalIncludeDirectories) + _WIN32;WIN32;_MT;NDEBUG;_LIB_WIN32;_WINDOWS;_CONSOLE;CLIENT;BOINC_APP_GRAPHICS;%(PreprocessorDefinitions) + Async + MultiThreaded + Fast + NotUsing + boinc_win.h + $(IntDir)$(TargetName).pch + + + Level4 + ProgramDatabase + CompileAsCpp + + + boinc_win.h;%(ForcedIncludeFiles) + + + .\Build\$(Platform)\$(Configuration)\libboinc_staticcrt.lib + ../openssl/win32/x86/lib;%(AdditionalLibraryDirectories) + + + + + X64 + + + ..;../win_build;../lib;../api;../../boinc_depends_win_vs2010/openssl/include;../coprocs/cuda/include;../coprocs/OpenCL/include;%(AdditionalIncludeDirectories) + _WIN32;WIN32;_MT;NDEBUG;_LIB_WIN32;_WINDOWS;_CONSOLE;CLIENT;BOINC_APP_GRAPHICS;%(PreprocessorDefinitions) + Async + MultiThreaded + Fast + NotUsing + boinc_win.h + $(IntDir)$(TargetName).pch + + + Level4 + ProgramDatabase + CompileAsCpp + + + boinc_win.h;%(ForcedIncludeFiles) + + + .\Build\$(Platform)\$(Configuration)\libboinc_staticcrt.lib + ../openssl/win32/x86/lib;%(AdditionalLibraryDirectories) + + + + + + \ No newline at end of file