-
Notifications
You must be signed in to change notification settings - Fork 3
Add ability to build DLL/shared object #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,38 @@ | |
|
|
||
| #include <stdint.h> | ||
|
|
||
| #ifdef __has_attribute | ||
| #if __has_attribute(visibility) | ||
| #define INFLATELIB_HAS_VISIBILITY_ATTR 1 | ||
| #endif | ||
| #endif | ||
|
|
||
| /* | ||
| * INFLATELIB_BUILD_SHARED The library is being built as a shared library | ||
| * INFLATELIB_CONSUME_SHARED The library is being consumed as a shared library | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interesting debate about whether shared should be the default mode of consumption or not
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. Nice thing about being "v0" is that we can delay that decision for now. We can also choose a separate default for the vcpkg port. One thing worth mentioning is that zlib ships as a shared object by default, at least on vcpkg |
||
| * Otherwise... The library is either being built as a static library or it is being consumed in an | ||
| * unspecified manner; either as a shared or static library. | ||
| */ | ||
| #if defined(_WIN32) && defined(_MSC_VER) | ||
| #ifdef INFLATELIB_BUILD_SHARED | ||
| #define INFLATELIB_EXPORT __declspec(dllexport) | ||
| #elif defined(INFLATELIB_CONSUME_SHARED) | ||
| #define INFLATELIB_EXPORT __declspec(dllimport) | ||
| #else | ||
| #define INFLATELIB_EXPORT /* Unknown or static - don't decorate function declarations */ | ||
| #endif | ||
| #elif INFLATELIB_HAS_VISIBILITY_ATTR | ||
| #define INFLATELIB_EXPORT __attribute__((visibility("default"))) | ||
| #else | ||
| #define INFLATELIB_EXPORT /* Not Windows and no visibility attribute... don't decorate function declarations */ | ||
| #endif | ||
|
|
||
| #if defined(_WIN32) && defined(_MSC_VER) | ||
| #define INFLATELIB_CALLCONV __cdecl | ||
| #else | ||
| #define INFLATELIB_CALLCONV | ||
| #endif | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
|
|
@@ -100,32 +132,32 @@ extern "C" | |
| * Initializes the stream. The 'user_data', 'alloc', and 'free' members MUST be set prior to the init call and MUST | ||
| * NOT be changed after the init call completes. This function returns one of the status values specified above. | ||
| */ | ||
| int inflatelib_init(inflatelib_stream* stream); | ||
| INFLATELIB_EXPORT int INFLATELIB_CALLCONV inflatelib_init(inflatelib_stream* stream); | ||
|
|
||
| /* | ||
| * Resets the stream's state back to its initialized state. This allows the stream to be reused for multiple inflate | ||
| * calls without having to destroy and reinitialize it. Typically, this is used to reset the stream after an inflate | ||
| * call returns EOF, however it can also be used to reset the stream after an error or even during the middle of | ||
| * inflating a stream. This function also allows the caller to switch between Deflate and Deflate64. | ||
| */ | ||
| int inflatelib_reset(inflatelib_stream* stream); | ||
| INFLATELIB_EXPORT int INFLATELIB_CALLCONV inflatelib_reset(inflatelib_stream* stream); | ||
|
|
||
| /* | ||
| * Cleans up any data allocated/initialized by the library. This function must be called if 'inflatelib_init' | ||
| * returns success. After this function is called, the 'inflatelib_stream' cannot be used for any function call | ||
| * unless 'inflatelib_init' is called again. This function can only return success. | ||
| */ | ||
| int inflatelib_destroy(inflatelib_stream* stream); | ||
| INFLATELIB_EXPORT int INFLATELIB_CALLCONV inflatelib_destroy(inflatelib_stream* stream); | ||
|
|
||
| /* | ||
| * | ||
| */ | ||
|
Comment on lines
152
to
154
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self to fill these in |
||
| int inflatelib_inflate(inflatelib_stream* stream); | ||
| INFLATELIB_EXPORT int INFLATELIB_CALLCONV inflatelib_inflate(inflatelib_stream* stream); | ||
|
|
||
| /* | ||
| * | ||
| */ | ||
| int inflatelib_inflate64(inflatelib_stream* stream); | ||
| INFLATELIB_EXPORT int INFLATELIB_CALLCONV inflatelib_inflate64(inflatelib_stream* stream); | ||
|
|
||
| #ifdef __cplusplus | ||
| } // extern "C" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #include <windows.h> | ||
| #include <inflatelib.h> | ||
|
|
||
| //--------------------------------------------------------------- | ||
| // Version Information | ||
| //--------------------------------------------------------------- | ||
| VS_VERSION_INFO VERSIONINFO | ||
| FILEVERSION INFLATELIB_VERSION_MAJOR,INFLATELIB_VERSION_MINOR,INFLATELIB_VERSION_PATCH,0 | ||
| PRODUCTVERSION INFLATELIB_VERSION_MAJOR,INFLATELIB_VERSION_MINOR,INFLATELIB_VERSION_PATCH,0 | ||
| FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | ||
| #ifdef _DEBUG | ||
| FILEFLAGS 1 | ||
| #else | ||
| FILEFLAGS 0 | ||
| #endif | ||
| FILEOS VOS__WINDOWS32 | ||
| FILETYPE VFT_DLL | ||
| FILESUBTYPE VFT2_UNKNOWN | ||
| BEGIN | ||
| BLOCK "StringFileInfo" | ||
| BEGIN | ||
| BLOCK "040904e4" // US English + ANSI Latin 1 | ||
| BEGIN | ||
| VALUE "CompanyName", "Microsoft Corporation\0" | ||
| VALUE "FileDescription", "InflateLib decompression library\0" | ||
| VALUE "FileVersion", INFLATELIB_VERSION_STRING "\0" | ||
| VALUE "InternalName", "inflatelib.dll\0" | ||
| VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" | ||
| VALUE "OriginalFilename", "inflatelib.dll\0" | ||
| VALUE "ProductName", "InflateLib\0" | ||
| VALUE "ProductVersion", INFLATELIB_VERSION_STRING "\0" | ||
| END | ||
| END | ||
|
|
||
| BLOCK "VarFileInfo" | ||
| BEGIN | ||
| // Language ID, Code Page (0409 = US English, 1252 = ANSI Latin 1; Western European) | ||
| VALUE "Translation", 0x0409, 1252 | ||
| END | ||
| END |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly
-swas already taken andgetoptsdoesn't allow multi character options such as-so:(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alas!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could go for case sensitive
Sif you're feeling SpicyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not feeling that spicy