diff --git a/Makefile b/Makefile index 231d84a..709aa80 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ # This Makefile will build a DLL and an application using the DLL. -all : AddLib.dll AddTest.exe +all: AddLib.dll AddTest.exe -AddLib.dll : include/add.h +AddLib.dll: include/add.h gcc -O3 -std=c99 -D ADD_EXPORTS -Wall -I.\include -c src/add.c -o obj/add.o windres -i res/resource.rc -o obj/resource.o gcc -o AddLib.dll obj/add.o obj/resource.o -shared -s -Wl,--subsystem,windows,--out-implib,libaddlib.a -AddTest.exe : include/add.h AddLib.dll +AddTest.exe: include/add.h AddLib.dll gcc -O3 -std=c99 -Wall -I.\include -c src/addtest.c -o obj/addtest.o gcc -o AddTest.exe obj/addtest.o -s -L. -lAddLib -clean : +clean: del obj\*.o *.exe *.dll *.a \ No newline at end of file diff --git a/Readme.txt b/Readme.txt index f6da361..477f6d8 100644 --- a/Readme.txt +++ b/Readme.txt @@ -18,23 +18,26 @@ compiler are named your version of the make utility may be named differently—please check the documentation which came with your MinGW packages. + Disclaimer This program 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. + Terms of Use There is no specific license attached to the use this application. You are free to use it however you see fit, whether for commercial or non-commercial purposes. The intention is that you use it as a starting point for building -Windows applications, so that you don’t have to write all of your applications -from scratch. You are encouraged to modify it to suit your needs as a Windows -application template, and how you license any applictions built with it is +Windows DLLs, so that you don’t have to write all of your DLL projects from +scratch. You are encouraged to modify it to suit your needs as a Windows +DLL project template, and how you license any applictions built with it is entirely up to you. Of course, you must still comply with the licensing conditions of the tools you are using to build the application. + Problems? If you have any problems or questions, please get in contact via @@ -42,5 +45,17 @@ http://www.transmissionzero.co.uk/contact/. Please ensure that you read the article at http://www.transmissionzero.co.uk/computing/building-dlls-with-mingw/ before sending any questions. + +Changelog + +2013–08–26: Version 1.1 + + • Minor tweaks to the VERSIONINFO resource so that it uses constants rather + than magic numbers. + +2011–04–16: Version 1.0 + + • First release. + Martin Payne -2011–04–16 \ No newline at end of file +2013–08–26 \ No newline at end of file diff --git a/res/resource.rc b/res/resource.rc index dcaa8f6..f2088ff 100644 --- a/res/resource.rc +++ b/res/resource.rc @@ -1,33 +1,35 @@ -1 VERSIONINFO - FILEVERSION 1,0,0,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK 0x17L +#include + +// DLL version information. +VS_VERSION_INFO VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK #ifdef _DEBUG - FILEFLAGS 0x1L + FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE #else - FILEFLAGS 0x0L + FILEFLAGS 0 #endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_DLL +FILESUBTYPE VFT2_UNKNOWN BEGIN - BLOCK "StringFileInfo" + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904b0" BEGIN - BLOCK "080904b0" - BEGIN - VALUE "Comments", "Addition Library" - VALUE "CompanyName", "Transmission Zero" - VALUE "FileDescription", "A library to perform addition." - VALUE "FileVersion", "1, 0, 0, 0" - VALUE "InternalName", "AddLib" - VALUE "LegalCopyright", "©2011 Martin Payne" - VALUE "OriginalFilename", "AddLib.dll" - VALUE "ProductName", "Addition Library" - VALUE "ProductVersion", "1, 0, 0, 0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1200 + VALUE "CompanyName", "Transmission Zero" + VALUE "FileDescription", "A library to perform addition." + VALUE "FileVersion", "1.0.0.0" + VALUE "InternalName", "AddLib" + VALUE "LegalCopyright", "©2013 Transmission Zero" + VALUE "OriginalFilename", "AddLib.dll" + VALUE "ProductName", "Addition Library" + VALUE "ProductVersion", "1.0.0.0" END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1200 + END END diff --git a/src/add.c b/src/add.c index b848f39..2fe606f 100644 --- a/src/add.c +++ b/src/add.c @@ -10,6 +10,6 @@ int ADDCALL Add(int a, int b) return (a + b); } -/* Assign value to exported variables. */ +/* Assign values to exported variables. */ int foo = 7; int bar = 41; diff --git a/src/addtest.c b/src/addtest.c index f64309a..534bff1 100644 --- a/src/addtest.c +++ b/src/addtest.c @@ -9,7 +9,7 @@ int main(int argc, char** argv) { - /* foo + bar = Add(foo, bar) */ + /* Add foo and bar variables exported from the DLL */ printf("%d + %d = %d\n", foo, bar, Add(foo, bar)); return EXIT_SUCCESS;