From c6104a924d510512b32c343e6fe9af12f8050a06 Mon Sep 17 00:00:00 2001 From: Gordan Kucinar Date: Mon, 12 Nov 2018 16:20:33 +0100 Subject: [PATCH 1/5] initial commit --- exercise/01/app/app.cpp | Bin 0 -> 1690 bytes exercise/01/app/app.vcxproj | 168 ++++++++++++++++++++++++++++ exercise/01/app/app.vcxproj.filters | 30 +++++ exercise/01/app/pch.cpp | Bin 0 -> 430 bytes exercise/01/app/pch.h | Bin 0 -> 1262 bytes 5 files changed, 198 insertions(+) create mode 100644 exercise/01/app/app.cpp create mode 100644 exercise/01/app/app.vcxproj create mode 100644 exercise/01/app/app.vcxproj.filters create mode 100644 exercise/01/app/pch.cpp create mode 100644 exercise/01/app/pch.h diff --git a/exercise/01/app/app.cpp b/exercise/01/app/app.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bbc1940d400031aee0c8675da12ed95cf9257552 GIT binary patch literal 1690 zcma)-U29W85QgVk@IS2aqKcBBwqDdy5N&HgthABdc$1!_$4HtJ@?i_&Uss=ZCYzJQ zgOp{@Zg%J6op)w7e|~qYW663pVYIFAHQ7FAUHfK3o3XoQ9oc|gVU>+-j{J~ScXOn4 zvtu{Q(;e4Xa9?mcbd5G=pKZ#%@YBY_XC`cEw4#vfaZ*-zBxy-lj;k?V&vY zd&gJpAG=-w(go7O)FPS!d~IgS<^Gj9aD+23$f}SXt}H6XId*bnPwc7R{q%3*Mnk%N z7~6Mt6iu=NhWvlP=7>@8>yq!3ecvA0S1h;e4W~l>YvnPraZUtd?j{?IDJSn7=ZM`i z=CSSZmDObL@pOe=$^MXefn<*xp}8bR<*9P6*JXoi>D-_{=03B!F4ctOzP@W*&Aw`X zT~JPz^%gOmfN9Q99)z)uY2b_pd%>A9@q$bz`+^N+KUd}jajPbBEhamn@+O`Yl1!Mn+R_?`W$*WjX&CD3V%{C*ujaZK0TgavV z5nt+_X8wP0JMercN1?OrW6yn@U@vnOugrHegF*GeThC;&PfL5J_#A*f>l9d5o^+bX zb$C@S;vK1T{+#>3{y#s;bwrjcciUssR=k0ml1*MS&Ro&)F60>N4pJSyc1BK#LR#@Q zUwh^k9;G6Ps;cM#^?b<1OTTGZJy0?gh4jibo{u?={{%67wz8#P+uY>ZQI$z2*LI+5 NQv)N%k$F}`e*u?d68r!F literal 0 HcmV?d00001 diff --git a/exercise/01/app/app.vcxproj b/exercise/01/app/app.vcxproj new file mode 100644 index 0000000..a9c0f09 --- /dev/null +++ b/exercise/01/app/app.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783} + Win32Proj + app + 10.0.17134.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/exercise/01/app/app.vcxproj.filters b/exercise/01/app/app.vcxproj.filters new file mode 100644 index 0000000..cffaa85 --- /dev/null +++ b/exercise/01/app/app.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/exercise/01/app/pch.cpp b/exercise/01/app/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a38f8a37da858b0e7a4a577210e923c883ac97f3 GIT binary patch literal 430 zcma)(OAdlS5JYQj;vFWsRoUwaJO;ubLXfO} ziM!*RK?b#&)PqF4LX~Q_GVq=g$>^{f<-{7@$r|ykmqm|MwtC_%l{t|TJS9Jpalvn} ztpC7C!Dg_+`-h+El+KlNtsDc|GOvyF+iK(A-j!r1ot!0T2mdlziM{46Ghg8k=#H+V zM?tLvNCnoo3Y&aHb%nm~4lL&e!^r!5 zY>)Yt7?F2lcmBR1+QK#-XGNr7XZ8fr!cn3lZ5^Y)vUSfD^AwDN*h^Lw&)lPx++47# zd)SAA*b{C}iSS;`84M~$v>AMrgP7FJ8+gu~LAukhS6*EOJ`b`OdG>3c0~t!sZmv>H zn*HLA@+(*ivq2}#QbRtnCS6sZB|bGHY13EaXpqYpyv1DpS76m1eTdT|r_t-78YQ1T z#<62u5HD*r_L~oQCI!E8@(t$Ve*GNp63pmTN&3$4QJrKBuD-fJIu~wfYrcy;aeoU( z{gpDyo!duDy%mVwzd3}ObITpQ?&R3*fD>2bk}TRUp!6E5gQ6*el=X_*#+Q5I8?Z>{ zRy|dAN-mZA&0pz!j#b}5FeyBGiKSg%o7_9|!S#V|#ttsxpDyDUbdaS$838t Date: Mon, 12 Nov 2018 16:52:27 +0100 Subject: [PATCH 2/5] Done --- exercise/01/app/app.cpp | Bin 1690 -> 2234 bytes exercise/01/app/app.vcxproj | 14 + exercise/01/app/app.vcxproj.filters | 6 + exercise/01/app/dynamic_link.cpp | 12 + exercise/01/app/dynamic_link.h | 6 + exercise/01/dll1/dynamic_library.vcxproj | 396 +++++++++--------- .../dll2/dynamic_library_with_implib.vcxproj | 342 +++++++-------- exercise/01/e01.sln | 132 +++--- 8 files changed, 473 insertions(+), 435 deletions(-) create mode 100644 exercise/01/app/dynamic_link.cpp create mode 100644 exercise/01/app/dynamic_link.h diff --git a/exercise/01/app/app.cpp b/exercise/01/app/app.cpp index bbc1940d400031aee0c8675da12ed95cf9257552..4c4168da7a65a06b49c6399d493c01ec9d5c7abd 100644 GIT binary patch delta 560 zcmbVI%?bfg6#j0pQ5LhXAdBl~L5fl~C>u*<;Q?fRVlswuk=5iGX6GrCou~879Sc)T z(plW@`OZ1t&o%!rZY2@a;KGLm4+q$AAW=n|)nUhl$#+M@)IW>;74bZB_`YXz)BGGqGpuNrx&T0|RYRzHY{t6;6fWjuT2HPE?^7i{!guSaEFcs{UjTN1_sZ cW82b&O5yaerQf8YPdUi+Br;JH_lqcIpW|C!YybcN delta 54 zcmdlbIE#0K6yxMWjB1nrF)1i|Fr+f%0AW6Z0z){EECRAq7!(;|81fjD7_1o-HZNqB GWCZ|?;tYoX diff --git a/exercise/01/app/app.vcxproj b/exercise/01/app/app.vcxproj index a9c0f09..a1366fd 100644 --- a/exercise/01/app/app.vcxproj +++ b/exercise/01/app/app.vcxproj @@ -72,15 +72,19 @@ true + ..\$(Platform)\$(Configuration)\ true + ..\$(Platform)\$(Configuration)\ false + ..\$(Platform)\$(Configuration)\ false + ..\$(Platform)\$(Configuration)\ @@ -95,6 +99,8 @@ Console true + ..\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\dll1\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\lib\$(Platform)\$(Configuration) + static_library.lib;dynamic_library_with_implib.lib;%(AdditionalDependencies) @@ -110,6 +116,8 @@ Console true + ..\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\dll1\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\lib\$(Platform)\$(Configuration) + static_library.lib;dynamic_library_with_implib.lib;%(AdditionalDependencies) @@ -129,6 +137,8 @@ true true true + ..\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\dll1\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\lib\$(Platform)\$(Configuration) + static_library.lib;dynamic_library_with_implib.lib;%(AdditionalDependencies) @@ -148,13 +158,17 @@ true true true + ..\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\dll1\$(Platform)\$(Configuration);D:\cpp_training\day1\exercise\01\lib\$(Platform)\$(Configuration) + static_library.lib;dynamic_library_with_implib.lib;%(AdditionalDependencies) + + Create Create diff --git a/exercise/01/app/app.vcxproj.filters b/exercise/01/app/app.vcxproj.filters index cffaa85..675e55d 100644 --- a/exercise/01/app/app.vcxproj.filters +++ b/exercise/01/app/app.vcxproj.filters @@ -18,6 +18,9 @@ Header Files + + Source Files + @@ -26,5 +29,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/exercise/01/app/dynamic_link.cpp b/exercise/01/app/dynamic_link.cpp new file mode 100644 index 0000000..dac0be9 --- /dev/null +++ b/exercise/01/app/dynamic_link.cpp @@ -0,0 +1,12 @@ +#include "pch.h" +#include "dynamic_link.h" +#include + + +double no_implib::get_value(int input) +{ + using get_value_func = double(*)(int) ; + HMODULE module = LoadLibraryA("dynamic_library.dll"); + get_value_func func = (get_value_func)GetProcAddress(module, "get_value"); + return func(input); +} \ No newline at end of file diff --git a/exercise/01/app/dynamic_link.h b/exercise/01/app/dynamic_link.h new file mode 100644 index 0000000..86f984e --- /dev/null +++ b/exercise/01/app/dynamic_link.h @@ -0,0 +1,6 @@ +#pragma once + +namespace no_implib +{ + double get_value(int input); +} diff --git a/exercise/01/dll1/dynamic_library.vcxproj b/exercise/01/dll1/dynamic_library.vcxproj index 7530308..d9011be 100644 --- a/exercise/01/dll1/dynamic_library.vcxproj +++ b/exercise/01/dll1/dynamic_library.vcxproj @@ -1,199 +1,199 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {92DBD108-3D52-419D-BC33-217327A4AD9D} - Win32Proj - dynamiclibrary - 10.0.17134.0 - - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - $(Platform)\$(Configuration)\ - - - false - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - $(Platform)\$(Configuration)\ - - - - Use - Level3 - Disabled - true - WIN32;_DEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - del $(TargetDir)\dynamic_library.lib - - - - - - - Use - Level3 - Disabled - true - _DEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - del $(TargetDir)\dynamic_library.lib - - - - - - - Use - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - del $(TargetDir)\dynamic_library.lib - - - - - - - Use - Level3 - MaxSpeed - true - true - true - NDEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - del $(TargetDir)\dynamic_library.lib - - - - - - - - - - - - Create - Create - Create - Create - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {92DBD108-3D52-419D-BC33-217327A4AD9D} + Win32Proj + dynamiclibrary + 10.0.17134.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + ..\$(Platform)\$(Configuration)\ + + + false + ..\$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + ..\$(Platform)\$(Configuration)\ + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + del $(TargetDir)\dynamic_library.lib + + + + + + + Use + Level3 + Disabled + true + _DEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + del $(TargetDir)\dynamic_library.lib + + + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + del $(TargetDir)\dynamic_library.lib + + + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;DYNAMICLIBRARY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + del $(TargetDir)\dynamic_library.lib + + + + + + + + + + + + Create + Create + Create + Create + + + + + \ No newline at end of file diff --git a/exercise/01/dll2/dynamic_library_with_implib.vcxproj b/exercise/01/dll2/dynamic_library_with_implib.vcxproj index 9ad2802..5e24624 100644 --- a/exercise/01/dll2/dynamic_library_with_implib.vcxproj +++ b/exercise/01/dll2/dynamic_library_with_implib.vcxproj @@ -1,172 +1,172 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {4EA09877-C87B-489E-9F80-A921D8E66E46} - Win32Proj - dynamiclibrarywithimplib - 10.0.17134.0 - - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - true - $(Platform)\$(Configuration)\ - - - false - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - false - $(Platform)\$(Configuration)\ - - - - Use - Level3 - Disabled - true - WIN32;_DEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Use - Level3 - Disabled - true - _DEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - - - - - Use - Level3 - MaxSpeed - true - true - true - WIN32;NDEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - Use - Level3 - MaxSpeed - true - true - true - NDEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - - - Windows - true - true - true - - - - - - - - - - - Create - Create - Create - Create - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {4EA09877-C87B-489E-9F80-A921D8E66E46} + Win32Proj + dynamiclibrarywithimplib + 10.0.17134.0 + + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + DynamicLibrary + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + ..\$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + ..\$(Platform)\$(Configuration)\ + + + false + ..\$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + false + ..\$(Platform)\$(Configuration)\ + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Use + Level3 + Disabled + true + _DEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;DYNAMICLIBRARYWITHIMPLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + Create + Create + Create + Create + + + + + \ No newline at end of file diff --git a/exercise/01/e01.sln b/exercise/01/e01.sln index fb6ce37..36d6e54 100644 --- a/exercise/01/e01.sln +++ b/exercise/01/e01.sln @@ -1,66 +1,66 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.2036 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "lib\static_library.vcxproj", "{990D865F-0DF2-40ED-8622-8DD0DB4A2128}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "app", "app\app.vcxproj", "{843D77A9-6E04-4515-91D5-A010A5CDF8E0}" - ProjectSection(ProjectDependencies) = postProject - {92DBD108-3D52-419D-BC33-217327A4AD9D} = {92DBD108-3D52-419D-BC33-217327A4AD9D} - {990D865F-0DF2-40ED-8622-8DD0DB4A2128} = {990D865F-0DF2-40ED-8622-8DD0DB4A2128} - {4EA09877-C87B-489E-9F80-A921D8E66E46} = {4EA09877-C87B-489E-9F80-A921D8E66E46} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library", "dll1\dynamic_library.vcxproj", "{92DBD108-3D52-419D-BC33-217327A4AD9D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library_with_implib", "dll2\dynamic_library_with_implib.vcxproj", "{4EA09877-C87B-489E-9F80-A921D8E66E46}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x64.ActiveCfg = Debug|x64 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x64.Build.0 = Debug|x64 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x86.ActiveCfg = Debug|Win32 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x86.Build.0 = Debug|Win32 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x64.ActiveCfg = Release|x64 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x64.Build.0 = Release|x64 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x86.ActiveCfg = Release|Win32 - {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x86.Build.0 = Release|Win32 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Debug|x64.ActiveCfg = Debug|x64 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Debug|x64.Build.0 = Debug|x64 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Debug|x86.ActiveCfg = Debug|Win32 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Debug|x86.Build.0 = Debug|Win32 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Release|x64.ActiveCfg = Release|x64 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Release|x64.Build.0 = Release|x64 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Release|x86.ActiveCfg = Release|Win32 - {843D77A9-6E04-4515-91D5-A010A5CDF8E0}.Release|x86.Build.0 = Release|Win32 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x64.ActiveCfg = Debug|x64 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x64.Build.0 = Debug|x64 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x86.ActiveCfg = Debug|Win32 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x86.Build.0 = Debug|Win32 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x64.ActiveCfg = Release|x64 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x64.Build.0 = Release|x64 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x86.ActiveCfg = Release|Win32 - {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x86.Build.0 = Release|Win32 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x64.ActiveCfg = Debug|x64 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x64.Build.0 = Debug|x64 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x86.ActiveCfg = Debug|Win32 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x86.Build.0 = Debug|Win32 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x64.ActiveCfg = Release|x64 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x64.Build.0 = Release|x64 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.ActiveCfg = Release|Win32 - {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D6B8F75A-8322-45FC-87C0-577EA4FE9944} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "lib\static_library.vcxproj", "{990D865F-0DF2-40ED-8622-8DD0DB4A2128}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library", "dll1\dynamic_library.vcxproj", "{92DBD108-3D52-419D-BC33-217327A4AD9D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynamic_library_with_implib", "dll2\dynamic_library_with_implib.vcxproj", "{4EA09877-C87B-489E-9F80-A921D8E66E46}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "app", "app\app.vcxproj", "{989718E3-A5A8-4B54-92D9-FAE42C8C7783}" + ProjectSection(ProjectDependencies) = postProject + {92DBD108-3D52-419D-BC33-217327A4AD9D} = {92DBD108-3D52-419D-BC33-217327A4AD9D} + {990D865F-0DF2-40ED-8622-8DD0DB4A2128} = {990D865F-0DF2-40ED-8622-8DD0DB4A2128} + {4EA09877-C87B-489E-9F80-A921D8E66E46} = {4EA09877-C87B-489E-9F80-A921D8E66E46} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x64.ActiveCfg = Debug|x64 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x64.Build.0 = Debug|x64 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x86.ActiveCfg = Debug|Win32 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Debug|x86.Build.0 = Debug|Win32 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x64.ActiveCfg = Release|x64 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x64.Build.0 = Release|x64 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x86.ActiveCfg = Release|Win32 + {990D865F-0DF2-40ED-8622-8DD0DB4A2128}.Release|x86.Build.0 = Release|Win32 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x64.ActiveCfg = Debug|x64 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x64.Build.0 = Debug|x64 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x86.ActiveCfg = Debug|Win32 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Debug|x86.Build.0 = Debug|Win32 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x64.ActiveCfg = Release|x64 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x64.Build.0 = Release|x64 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x86.ActiveCfg = Release|Win32 + {92DBD108-3D52-419D-BC33-217327A4AD9D}.Release|x86.Build.0 = Release|Win32 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x64.ActiveCfg = Debug|x64 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x64.Build.0 = Debug|x64 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x86.ActiveCfg = Debug|Win32 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Debug|x86.Build.0 = Debug|Win32 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x64.ActiveCfg = Release|x64 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x64.Build.0 = Release|x64 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.ActiveCfg = Release|Win32 + {4EA09877-C87B-489E-9F80-A921D8E66E46}.Release|x86.Build.0 = Release|Win32 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Debug|x64.ActiveCfg = Debug|x64 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Debug|x64.Build.0 = Debug|x64 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Debug|x86.ActiveCfg = Debug|Win32 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Debug|x86.Build.0 = Debug|Win32 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Release|x64.ActiveCfg = Release|x64 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Release|x64.Build.0 = Release|x64 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Release|x86.ActiveCfg = Release|Win32 + {989718E3-A5A8-4B54-92D9-FAE42C8C7783}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D6B8F75A-8322-45FC-87C0-577EA4FE9944} + EndGlobalSection +EndGlobal From c3cd3554e2d3b918c03d896cd6a404f50ba14ade Mon Sep 17 00:00:00 2001 From: Gordan Kucinar Date: Mon, 12 Nov 2018 16:58:55 +0100 Subject: [PATCH 3/5] Done with exception --- exercise/01/app/dynamic_link.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exercise/01/app/dynamic_link.cpp b/exercise/01/app/dynamic_link.cpp index dac0be9..7655de1 100644 --- a/exercise/01/app/dynamic_link.cpp +++ b/exercise/01/app/dynamic_link.cpp @@ -1,12 +1,17 @@ #include "pch.h" #include "dynamic_link.h" #include +#include double no_implib::get_value(int input) { using get_value_func = double(*)(int) ; HMODULE module = LoadLibraryA("dynamic_library.dll"); + if (!module) + throw "no dll"; get_value_func func = (get_value_func)GetProcAddress(module, "get_value"); + if (!func) + throw "no get_value function found in dynamic_library.dll"; return func(input); } \ No newline at end of file From 96fe2ce0e3947ce4e09b29d39a4670320d2de7f8 Mon Sep 17 00:00:00 2001 From: Gordan Kucinar Date: Mon, 12 Nov 2018 22:39:20 +0100 Subject: [PATCH 4/5] Zaboravio FreeLibrary --- exercise/01/app/dynamic_link.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/exercise/01/app/dynamic_link.cpp b/exercise/01/app/dynamic_link.cpp index 7655de1..a1aa41d 100644 --- a/exercise/01/app/dynamic_link.cpp +++ b/exercise/01/app/dynamic_link.cpp @@ -4,13 +4,23 @@ #include + double no_implib::get_value(int input) { + struct scoped_library + { + HMODULE module; + scoped_library() + { + module = LoadLibraryA("dynamic_library.dll"); + } + ~scoped_library() { if(module) FreeLibrary(module); } + + } loader; using get_value_func = double(*)(int) ; - HMODULE module = LoadLibraryA("dynamic_library.dll"); - if (!module) + if (!loader.module) throw "no dll"; - get_value_func func = (get_value_func)GetProcAddress(module, "get_value"); + get_value_func func = (get_value_func)GetProcAddress(loader.module, "get_value"); if (!func) throw "no get_value function found in dynamic_library.dll"; return func(input); From d6d8d9399399f3849d94422ed6020c88857c17c4 Mon Sep 17 00:00:00 2001 From: Gordan Kucinar Date: Tue, 13 Nov 2018 11:18:33 +0100 Subject: [PATCH 5/5] testovi prolaze --- exercise/02/code.cpp | 12 ++++++++++++ exercise/02/code.h | 3 +++ exercise/02/test1.cpp | 10 +++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/exercise/02/code.cpp b/exercise/02/code.cpp index 85e778c..2c6c68b 100644 --- a/exercise/02/code.cpp +++ b/exercise/02/code.cpp @@ -1,2 +1,14 @@ #include "stdafx.h" #include "code.h" +#include + +void f1(int & a, int & b) +{ + a = 2; + b = 1; +} + +void f2(int* first, int* last) +{ + std::transform(first, last, first, [](int i) {return i + 1; }); +} diff --git a/exercise/02/code.h b/exercise/02/code.h index e69de29..9b36766 100644 --- a/exercise/02/code.h +++ b/exercise/02/code.h @@ -0,0 +1,3 @@ +#pragma once +void f1(int & a, int & b); +void f2(int* first, int* last); \ No newline at end of file diff --git a/exercise/02/test1.cpp b/exercise/02/test1.cpp index 33dfab7..1077e77 100644 --- a/exercise/02/test1.cpp +++ b/exercise/02/test1.cpp @@ -1,9 +1,9 @@ #include "stdafx.h" #include "CppUnitTest.h" - +#include "code.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; -#include "code.h" + namespace simple_test { @@ -14,14 +14,14 @@ namespace simple_test TEST_METHOD(f1_changes_values) { int a=1, b=2; - //f1(a, b); + f1(a, b); Assert::AreEqual(2, a); Assert::AreEqual(1, b); } TEST_METHOD(f2_increases_all_values_by_one) { int arr[] = { 1, 2, 3 }; - //f2(arr, arr+3); + f2(arr, arr+3); Assert::AreEqual(2, arr[0]); Assert::AreEqual(3, arr[1]); Assert::AreEqual(4, arr[2]); @@ -29,7 +29,7 @@ namespace simple_test TEST_METHOD(f2_works_for_different_number_of_values) { int arr[] = { 2, 4, 6, 8, 10 }; - //f2(arr, arr+5); + f2(arr, arr+5); Assert::AreEqual(3, arr[0]); Assert::AreEqual(5, arr[1]); Assert::AreEqual(7, arr[2]);