├── .appveyor.yml ├── .github ├── FUNDING.yml └── workflows │ ├── ci-mac.yaml │ └── ci-win.yaml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── Build └── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── Unit-Tests ├── Info.plist ├── Mac.cpp └── Win.cpp ├── VisualStudio ├── All.vcxproj ├── All.vcxproj.filters ├── Unit-Tests.vcxproj ├── Unit-Tests.vcxproj.filters ├── dlib DLL VC142.vcxproj ├── dlib DLL VC142.vcxproj.filters ├── dlib DLL VC143.vcxproj ├── dlib DLL VC143.vcxproj.filters ├── dlib Static VC142.vcxproj ├── dlib Static VC142.vcxproj.filters ├── dlib Static VC143.vcxproj └── dlib Static VC143.vcxproj.filters ├── dlib.sln ├── dlib.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── dlib.xcscheme └── dlib ├── include ├── dlib-Manager.hpp ├── dlib-Module.hpp ├── dlib-macros.hpp ├── dlib-private-macros.hpp └── dlib.hpp └── source ├── dlib-Manager.cpp └── dlib-Module.cpp /.appveyor.yml: -------------------------------------------------------------------------------- 1 | image: 2 | - Visual Studio 2019 3 | platform: 4 | - x86 5 | - x64 6 | configuration: 7 | - Debug 8 | - Release 9 | install: 10 | - git submodule update --init --recursive 11 | build: 12 | project: dlib.sln 13 | before_build: 14 | - nuget restore 15 | for: 16 | - 17 | matrix: 18 | only: 19 | - platform: x86 20 | test_script: 21 | - '%APPVEYOR_BUILD_FOLDER%\Build\32\%CONFIGURATION%\Unit-Tests.exe' 22 | - 23 | matrix: 24 | only: 25 | - platform: x64 26 | test_script: 27 | - '%APPVEYOR_BUILD_FOLDER%\Build\64\%CONFIGURATION%\Unit-Tests.exe' 28 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: macmade 2 | -------------------------------------------------------------------------------- /.github/workflows/ci-mac.yaml: -------------------------------------------------------------------------------- 1 | name: ci-mac 2 | on: [push] 3 | jobs: 4 | ci: 5 | runs-on: macos-latest 6 | strategy: 7 | matrix: 8 | run-config: 9 | - { scheme: 'dlib', configuration: 'Debug', project: 'dlib.xcodeproj', build: 1, analyze: 1, test: 1, info: 1, destination: 'platform=macOS' } 10 | - { scheme: 'dlib', configuration: 'Release', project: 'dlib.xcodeproj', build: 1, analyze: 1, test: 0, info: 1, destination: 'platform=macOS' } 11 | steps: 12 | 13 | - uses: actions/checkout@v1 14 | with: 15 | submodules: 'recursive' 16 | 17 | - uses: macmade/action-xcodebuild@v1.0.0 18 | 19 | - uses: macmade/action-slack@v1.0.0 20 | if: ${{ always() }} 21 | env: 22 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 23 | with: 24 | channel: '#ci' 25 | status: ${{ job.status }} 26 | title: ${{ matrix.run-config[ 'scheme' ] }} - ${{ matrix.run-config[ 'configuration' ] }} 27 | -------------------------------------------------------------------------------- /.github/workflows/ci-win.yaml: -------------------------------------------------------------------------------- 1 | name: ci-win 2 | on: [push] 3 | jobs: 4 | ci: 5 | runs-on: windows-2022 6 | strategy: 7 | matrix: 8 | run-config: 9 | - { platform: 'x64', toolset: 'x64', configuration: 'Debug', solution: 'dlib.sln' } 10 | - { platform: 'x64', toolset: 'x64', configuration: 'Release', solution: 'dlib.sln' } 11 | - { platform: 'x86', toolset: 'x64', configuration: 'Debug', solution: 'dlib.sln' } 12 | - { platform: 'x86', toolset: 'x64', configuration: 'Release', solution: 'dlib.sln' } 13 | steps: 14 | 15 | - uses: actions/checkout@v1 16 | with: 17 | submodules: 'recursive' 18 | 19 | - uses: macmade/action-msbuild@v1.1.0 20 | 21 | - uses: macmade/action-slack@v1.0.0 22 | if: ${{ always() }} 23 | env: 24 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 25 | with: 26 | channel: '#ci' 27 | status: ${{ job.status }} 28 | title: ${{ matrix.run-config[ 'solution' ] }} - ${{ matrix.run-config[ 'configuration' ] }} - ${{ matrix.run-config[ 'platform' ] }} 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac Finder 2 | .DS_Store 3 | .Trashes 4 | Icon? 5 | 6 | # Thumbnails 7 | ._* 8 | 9 | # Files that might appear on external disk 10 | .Spotlight-V100 11 | .Trashes 12 | 13 | # Windows 14 | Thumbs.db 15 | 16 | # Xcode 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | *.xccheckout 22 | *.profraw 23 | !default.pbxuser 24 | !default.mode1v3 25 | !default.mode2v3 26 | !default.perspectivev3 27 | xcuserdata 28 | 29 | # VisualStudio 30 | *.suo 31 | *.sdf 32 | *.opensdf 33 | *.vcxproj.user 34 | *.csproj.user 35 | *.VC.db 36 | ipch 37 | .vs 38 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Submodules/xcconfig"] 2 | path = Submodules/xcconfig 3 | url = https://github.com/macmade/xcconfig.git 4 | [submodule "Submodules/XSTest"] 5 | path = Submodules/XSTest 6 | url = https://github.com/macmade/XSTest.git 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode10.2 3 | cache: 4 | directories: 5 | - $HOME/.ccache 6 | install: 7 | - gem install xcpretty 8 | - brew install ccache 9 | - PATH=$PATH:/usr/local/opt/ccache/libexec 10 | - export PYTHONUSERBASE=~/.local 11 | script: 12 | - set -o pipefail && xcodebuild -project "dlib.xcodeproj" -scheme "dlib" build test | xcpretty 13 | before_script: 14 | - ccache -s 15 | - ccache -z 16 | after_script: 17 | - ccache -s 18 | notifications: 19 | slack: xs-labs:FXh1yLXNkpcVxKZhZU6icdhI 20 | -------------------------------------------------------------------------------- /Build/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | xs-labs.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dlib 2 | ==== 3 | 4 | [![Build Status](https://img.shields.io/github/actions/workflow/status/macmade/dlib/ci-mac.yaml?label=macOS&logo=apple)](https://github.com/macmade/dlib/actions/workflows/ci-mac.yaml) 5 | [![Build Status](https://img.shields.io/github/actions/workflow/status/macmade/dlib/ci-win.yaml?label=Windows&logo=windows)](https://github.com/macmade/dlib/actions/workflows/ci-win.yaml) 6 | [![Issues](http://img.shields.io/github/issues/macmade/dlib.svg?logo=github)](https://github.com/macmade/dlib/issues) 7 | ![Status](https://img.shields.io/badge/status-active-brightgreen.svg?logo=git) 8 | ![License](https://img.shields.io/badge/license-mit-brightgreen.svg?logo=open-source-initiative) 9 | [![Contact](https://img.shields.io/badge/follow-@macmade-blue.svg?logo=twitter&style=social)](https://twitter.com/macmade) 10 | [![Sponsor](https://img.shields.io/badge/sponsor-macmade-pink.svg?logo=github-sponsors&style=social)](https://github.com/sponsors/macmade) 11 | 12 | ### Dynamic loading library for C++ 13 | 14 | License 15 | ------- 16 | 17 | dlib is released under the terms of the MIT License. 18 | 19 | Repository Infos 20 | ---------------- 21 | 22 | Owner: Jean-David Gadina - XS-Labs 23 | Web: www.xs-labs.com 24 | Blog: www.noxeos.com 25 | Twitter: @macmade 26 | GitHub: github.com/macmade 27 | LinkedIn: ch.linkedin.com/in/macmade/ 28 | StackOverflow: stackoverflow.com/users/182676/macmade 29 | -------------------------------------------------------------------------------- /Unit-Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Unit-Tests/Mac.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @file Mac.cpp 27 | * @copyright (c) 2018, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #define XSTEST_GTEST_COMPAT 31 | #include 32 | 33 | #define DLIB_S( _s_ ) _s_ 34 | 35 | #include 36 | 37 | extern void * AMRestoreCreateDefaultOptions( void * allocator ); 38 | extern void * AMRestoreCreateDefaultOptions_Invalid( void * allocator ); 39 | 40 | DLIB_FUNC_START( MobileDevice, void *, AMRestoreCreateDefaultOptions, void * allocator ) 41 | DLIB_FUNC_RET( MobileDevice, void *, AMRestoreCreateDefaultOptions, allocator ) 42 | 43 | DLIB_FUNC_START( MobileDevice, void *, AMRestoreCreateDefaultOptions_Invalid, void * allocator ) 44 | DLIB_FUNC_RET( MobileDevice, void *, AMRestoreCreateDefaultOptions_Invalid, allocator ) 45 | 46 | TEST( dlib, GetModule ) 47 | { 48 | dlib::Manager manager; 49 | dlib::Module * mod1( manager.GetModule( "MobileDevice" ) ); 50 | dlib::Module * mod2( manager.GetModule( "FooBar" ) ); 51 | 52 | manager.AddSearchPath( "/System/Library/PrivateFrameworks/" ); 53 | 54 | { 55 | dlib::Module * mod3( manager.GetModule( "MobileDevice" ) ); 56 | 57 | ASSERT_EQ( mod1, nullptr ); 58 | ASSERT_EQ( mod2, nullptr ); 59 | ASSERT_NE( mod3, nullptr ); 60 | } 61 | } 62 | 63 | TEST( dlib, GetSymbolAddress ) 64 | { 65 | dlib::Manager manager; 66 | 67 | manager.AddSearchPath( "/System/Library/PrivateFrameworks/" ); 68 | 69 | { 70 | dlib::Module * mod( manager.GetModule( "MobileDevice" ) ); 71 | 72 | ASSERT_NE( mod, nullptr ); 73 | ASSERT_NE( mod->GetSymbolAddress( "AMRestoreCreateDefaultOptions" ), nullptr ); 74 | ASSERT_EQ( mod->GetSymbolAddress( "AMRestoreCreateDefaultOptions_Invalid" ), nullptr ); 75 | } 76 | } 77 | 78 | TEST( dlib, Call ) 79 | { 80 | void * r1( 0 ); 81 | void * r2( r1 ); 82 | 83 | dlib::Manager::SharedInstance().AddSearchPath( "/System/Library/PrivateFrameworks/" ); 84 | 85 | ASSERT_NO_THROW( r1 = AMRestoreCreateDefaultOptions( NULL ) ); 86 | ASSERT_NO_THROW( r2 = AMRestoreCreateDefaultOptions_Invalid( NULL ) ); 87 | 88 | ASSERT_TRUE( r1 != 0 ); 89 | ASSERT_TRUE( r2 == 0 ); 90 | } 91 | -------------------------------------------------------------------------------- /Unit-Tests/Win.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @file WIN.cpp 27 | * @copyright (c) 2018, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #define XSTEST_MAIN 31 | #define XSTEST_GTEST_COMPAT 32 | #include 33 | 34 | #define DLIB_S( _s_ ) _s_ 35 | 36 | #include 37 | 38 | extern DWORD SymSetOptions( DWORD ); 39 | extern DWORD FooBar( DWORD ); 40 | 41 | DLIB_FUNC_START( DbgHelp, DWORD, SymSetOptions, DWORD i ) 42 | DLIB_FUNC_RET( DbgHelp, DWORD, SymSetOptions, i ) 43 | 44 | DLIB_FUNC_START( DbgHelp, DWORD, FooBar, DWORD i ) 45 | DLIB_FUNC_RET( DbgHelp, DWORD, FooBar, i ) 46 | 47 | TEST( dlib, GetModule ) 48 | { 49 | dlib::Manager manager; 50 | dlib::Module * mod1( manager.GetModule( "DbgHelp" ) ); 51 | dlib::Module * mod2( manager.GetModule( "FooBar" ) ); 52 | 53 | manager.AddSearchPath( "C:\\Windows\\System32\\" ); 54 | 55 | { 56 | dlib::Module * mod3( manager.GetModule( "DbgHelp" ) ); 57 | 58 | ASSERT_EQ( mod1, nullptr ); 59 | ASSERT_EQ( mod2, nullptr ); 60 | ASSERT_NE( mod3, nullptr ); 61 | } 62 | } 63 | 64 | TEST( dlib, GetSymbolAddress ) 65 | { 66 | dlib::Manager manager; 67 | 68 | manager.AddSearchPath( "C:\\Windows\\System32\\" ); 69 | 70 | { 71 | dlib::Module * mod( manager.GetModule( "DbgHelp" ) ); 72 | 73 | ASSERT_NE( mod, nullptr ); 74 | ASSERT_NE( mod->GetSymbolAddress( "SymSetOptions" ), nullptr ); 75 | ASSERT_EQ( mod->GetSymbolAddress( "FooBar" ), nullptr ); 76 | } 77 | } 78 | 79 | TEST( dlib, Call ) 80 | { 81 | DWORD r1( 0 ); 82 | DWORD r2( 1 ); 83 | 84 | dlib::Manager::SharedInstance().AddSearchPath( "C:\\Windows\\System32\\" ); 85 | 86 | ASSERT_NO_THROW( r1 = SymSetOptions( 42 ) ); 87 | ASSERT_NO_THROW( r2 = FooBar( 42 ) ); 88 | 89 | ASSERT_TRUE( r1 != 0 ); 90 | ASSERT_TRUE( r2 == 0 ); 91 | } -------------------------------------------------------------------------------- /VisualStudio/All.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 15.0 23 | {BD0914E5-DE40-4CB3-913B-077B97307F29} 24 | All 25 | 10.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v143 32 | MultiByte 33 | 34 | 35 | Application 36 | false 37 | v143 38 | true 39 | MultiByte 40 | 41 | 42 | Application 43 | true 44 | v143 45 | MultiByte 46 | 47 | 48 | Application 49 | false 50 | v143 51 | true 52 | MultiByte 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | $(SolutionDir)Build\32\$(Configuration)\ 74 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 75 | 76 | 77 | $(SolutionDir)Build\32\$(Configuration)\ 78 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 79 | 80 | 81 | $(SolutionDir)Build\64\$(Configuration)\ 82 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 83 | 84 | 85 | $(SolutionDir)Build\64\$(Configuration)\ 86 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 87 | 88 | 89 | 90 | Level3 91 | Disabled 92 | true 93 | 94 | 95 | 96 | 97 | Level3 98 | Disabled 99 | true 100 | 101 | 102 | 103 | 104 | Level3 105 | MaxSpeed 106 | true 107 | true 108 | true 109 | 110 | 111 | true 112 | true 113 | 114 | 115 | 116 | 117 | Level3 118 | MaxSpeed 119 | true 120 | true 121 | true 122 | 123 | 124 | true 125 | true 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /VisualStudio/All.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | -------------------------------------------------------------------------------- /VisualStudio/Unit-Tests.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {1d94e4a4-d645-48fd-baf6-ac711c70f396} 27 | 28 | 29 | 30 | 15.0 31 | {1E3DC445-B328-491C-98D8-50C7F85C24A4} 32 | Win32Proj 33 | UnitTests 34 | 10.0 35 | 36 | 37 | 38 | Application 39 | true 40 | v143 41 | Unicode 42 | 43 | 44 | Application 45 | false 46 | v143 47 | true 48 | Unicode 49 | 50 | 51 | Application 52 | true 53 | v143 54 | Unicode 55 | 56 | 57 | Application 58 | false 59 | v143 60 | true 61 | Unicode 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | true 83 | $(SolutionDir)Build\32\$(Configuration)\ 84 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 85 | 86 | 87 | true 88 | $(SolutionDir)Build\64\$(Configuration)\ 89 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 90 | 91 | 92 | false 93 | $(SolutionDir)Build\32\$(Configuration)\ 94 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 95 | 96 | 97 | false 98 | $(SolutionDir)Build\64\$(Configuration)\ 99 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 100 | 101 | 102 | 103 | NotUsing 104 | Level3 105 | Disabled 106 | true 107 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 108 | true 109 | 110 | 111 | ..\dlib\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories) 112 | StdCall 113 | 114 | 115 | Console 116 | true 117 | 118 | 119 | 120 | 121 | NotUsing 122 | Level3 123 | Disabled 124 | true 125 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 126 | true 127 | 128 | 129 | ..\dlib\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories) 130 | StdCall 131 | 132 | 133 | Console 134 | true 135 | 136 | 137 | 138 | 139 | NotUsing 140 | Level3 141 | MaxSpeed 142 | true 143 | true 144 | true 145 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 146 | true 147 | 148 | 149 | ..\dlib\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories) 150 | StdCall 151 | 152 | 153 | Console 154 | true 155 | true 156 | true 157 | 158 | 159 | 160 | 161 | NotUsing 162 | Level3 163 | MaxSpeed 164 | true 165 | true 166 | true 167 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 168 | true 169 | 170 | 171 | ..\dlib\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories) 172 | StdCall 173 | 174 | 175 | Console 176 | true 177 | true 178 | true 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /VisualStudio/Unit-Tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /VisualStudio/dlib DLL VC142.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {69EA30FC-E07D-46AD-AA31-5D405318896F} 34 | Win32Proj 35 | CF 36 | 10.0 37 | dlib DLL VC142 38 | 39 | 40 | 41 | DynamicLibrary 42 | true 43 | v142 44 | Unicode 45 | 46 | 47 | DynamicLibrary 48 | true 49 | v142 50 | Unicode 51 | 52 | 53 | DynamicLibrary 54 | false 55 | v142 56 | true 57 | Unicode 58 | 59 | 60 | DynamicLibrary 61 | false 62 | v142 63 | true 64 | Unicode 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 84 | $(SolutionDir)Build\32\$(Configuration)\ 85 | dlib_V142 86 | 87 | 88 | $(SolutionDir)Build\64\$(Configuration)\ 89 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 90 | dlib_V142 91 | 92 | 93 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 94 | $(SolutionDir)Build\32\$(Configuration)\ 95 | dlib_V142 96 | 97 | 98 | $(SolutionDir)Build\64\$(Configuration)\ 99 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 100 | dlib_V142 101 | 102 | 103 | 104 | NotUsing 105 | Level3 106 | Disabled 107 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 108 | ..\dlib\include;%(AdditionalIncludeDirectories) 109 | 110 | 111 | Windows 112 | true 113 | 114 | 115 | 116 | 117 | NotUsing 118 | Level3 119 | Disabled 120 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 121 | ..\dlib\include;%(AdditionalIncludeDirectories) 122 | 123 | 124 | Windows 125 | true 126 | 127 | 128 | 129 | 130 | Level3 131 | NotUsing 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 136 | ..\dlib\include;%(AdditionalIncludeDirectories) 137 | true 138 | 139 | 140 | Windows 141 | true 142 | true 143 | true 144 | 145 | 146 | 147 | 148 | Level3 149 | NotUsing 150 | MaxSpeed 151 | true 152 | true 153 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 154 | ..\dlib\include;%(AdditionalIncludeDirectories) 155 | true 156 | 157 | 158 | Windows 159 | true 160 | true 161 | true 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /VisualStudio/dlib DLL VC142.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {117f41f6-8cd6-4d85-8166-5cec1e6e21c7} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {d932b1d8-8a63-4702-b338-9bde0b856aad} 10 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | Header Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /VisualStudio/dlib DLL VC143.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA} 34 | Win32Proj 35 | CF 36 | 10.0 37 | dlib DLL VC143 38 | 39 | 40 | 41 | DynamicLibrary 42 | true 43 | v143 44 | Unicode 45 | 46 | 47 | DynamicLibrary 48 | true 49 | v143 50 | Unicode 51 | 52 | 53 | DynamicLibrary 54 | false 55 | v143 56 | true 57 | Unicode 58 | 59 | 60 | DynamicLibrary 61 | false 62 | v143 63 | true 64 | Unicode 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 84 | $(SolutionDir)Build\32\$(Configuration)\ 85 | dlib_V143 86 | 87 | 88 | $(SolutionDir)Build\64\$(Configuration)\ 89 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 90 | dlib_V143 91 | 92 | 93 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 94 | $(SolutionDir)Build\32\$(Configuration)\ 95 | dlib_V143 96 | 97 | 98 | $(SolutionDir)Build\64\$(Configuration)\ 99 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 100 | dlib_V143 101 | 102 | 103 | 104 | NotUsing 105 | Level3 106 | Disabled 107 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 108 | ..\dlib\include;%(AdditionalIncludeDirectories) 109 | 110 | 111 | Windows 112 | true 113 | 114 | 115 | 116 | 117 | NotUsing 118 | Level3 119 | Disabled 120 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 121 | ..\dlib\include;%(AdditionalIncludeDirectories) 122 | 123 | 124 | Windows 125 | true 126 | 127 | 128 | 129 | 130 | Level3 131 | NotUsing 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 136 | ..\dlib\include;%(AdditionalIncludeDirectories) 137 | true 138 | 139 | 140 | Windows 141 | true 142 | true 143 | true 144 | 145 | 146 | 147 | 148 | Level3 149 | NotUsing 150 | MaxSpeed 151 | true 152 | true 153 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 154 | ..\dlib\include;%(AdditionalIncludeDirectories) 155 | true 156 | 157 | 158 | Windows 159 | true 160 | true 161 | true 162 | 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /VisualStudio/dlib DLL VC143.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {117f41f6-8cd6-4d85-8166-5cec1e6e21c7} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {d932b1d8-8a63-4702-b338-9bde0b856aad} 10 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | Header Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /VisualStudio/dlib Static VC142.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396} 34 | Win32Proj 35 | CF 36 | 10.0 37 | dlib Static VC142 38 | 39 | 40 | 41 | StaticLibrary 42 | true 43 | v142 44 | Unicode 45 | 46 | 47 | StaticLibrary 48 | true 49 | v142 50 | Unicode 51 | 52 | 53 | StaticLibrary 54 | false 55 | v142 56 | true 57 | Unicode 58 | 59 | 60 | StaticLibrary 61 | false 62 | v142 63 | true 64 | Unicode 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 84 | $(SolutionDir)Build\32\$(Configuration)\ 85 | dlib_Static_V142 86 | 87 | 88 | $(SolutionDir)Build\64\$(Configuration)\ 89 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 90 | dlib_Static_V142 91 | 92 | 93 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 94 | $(SolutionDir)Build\32\$(Configuration)\ 95 | dlib_Static_V142 96 | 97 | 98 | $(SolutionDir)Build\64\$(Configuration)\ 99 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 100 | dlib_Static_V142 101 | 102 | 103 | 104 | NotUsing 105 | Level3 106 | Disabled 107 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 108 | ..\dlib\include;%(AdditionalIncludeDirectories) 109 | 110 | 111 | Windows 112 | true 113 | 114 | 115 | 116 | 117 | NotUsing 118 | Level3 119 | Disabled 120 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 121 | ..\dlib\include;%(AdditionalIncludeDirectories) 122 | 123 | 124 | Windows 125 | true 126 | 127 | 128 | 129 | 130 | Level3 131 | NotUsing 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 136 | ..\dlib\include;%(AdditionalIncludeDirectories) 137 | true 138 | false 139 | 140 | 141 | Windows 142 | true 143 | true 144 | true 145 | 146 | 147 | false 148 | 149 | 150 | 151 | 152 | Level3 153 | NotUsing 154 | MaxSpeed 155 | true 156 | true 157 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 158 | ..\dlib\include;%(AdditionalIncludeDirectories) 159 | true 160 | false 161 | 162 | 163 | Windows 164 | true 165 | true 166 | true 167 | 168 | 169 | false 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /VisualStudio/dlib Static VC142.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {117f41f6-8cd6-4d85-8166-5cec1e6e21c7} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {d932b1d8-8a63-4702-b338-9bde0b856aad} 10 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | Header Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /VisualStudio/dlib Static VC143.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA} 34 | Win32Proj 35 | CF 36 | 10.0 37 | dlib Static VC143 38 | 39 | 40 | 41 | StaticLibrary 42 | true 43 | v143 44 | Unicode 45 | 46 | 47 | StaticLibrary 48 | true 49 | v143 50 | Unicode 51 | 52 | 53 | StaticLibrary 54 | false 55 | v143 56 | true 57 | Unicode 58 | 59 | 60 | StaticLibrary 61 | false 62 | v143 63 | true 64 | Unicode 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 84 | $(SolutionDir)Build\32\$(Configuration)\ 85 | dlib_Static_V143 86 | 87 | 88 | $(SolutionDir)Build\64\$(Configuration)\ 89 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 90 | dlib_Static_V143 91 | 92 | 93 | $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ 94 | $(SolutionDir)Build\32\$(Configuration)\ 95 | dlib_Static_V143 96 | 97 | 98 | $(SolutionDir)Build\64\$(Configuration)\ 99 | $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ 100 | dlib_Static_V143 101 | 102 | 103 | 104 | NotUsing 105 | Level3 106 | Disabled 107 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 108 | ..\dlib\include;%(AdditionalIncludeDirectories) 109 | 110 | 111 | Windows 112 | true 113 | 114 | 115 | 116 | 117 | NotUsing 118 | Level3 119 | Disabled 120 | WIN32;_DEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 121 | ..\dlib\include;%(AdditionalIncludeDirectories) 122 | 123 | 124 | Windows 125 | true 126 | 127 | 128 | 129 | 130 | Level3 131 | NotUsing 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 136 | ..\dlib\include;%(AdditionalIncludeDirectories) 137 | true 138 | false 139 | 140 | 141 | Windows 142 | true 143 | true 144 | true 145 | 146 | 147 | false 148 | 149 | 150 | 151 | 152 | Level3 153 | NotUsing 154 | MaxSpeed 155 | true 156 | true 157 | WIN32;NDEBUG;_LIB;CFPP_DLL_BUILD;%(PreprocessorDefinitions) 158 | ..\dlib\include;%(AdditionalIncludeDirectories) 159 | true 160 | false 161 | 162 | 163 | Windows 164 | true 165 | true 166 | true 167 | 168 | 169 | false 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /VisualStudio/dlib Static VC143.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {117f41f6-8cd6-4d85-8166-5cec1e6e21c7} 6 | h;hpp;hxx;hm;inl;inc;xsd 7 | 8 | 9 | {d932b1d8-8a63-4702-b338-9bde0b856aad} 10 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | Header Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /dlib.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31903.59 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "All", "VisualStudio\All.vcxproj", "{BD0914E5-DE40-4CB3-913B-077B97307F29}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA} = {6BD7E43A-9F15-405F-B232-545F5C50F0FA} 9 | {1E3DC445-B328-491C-98D8-50C7F85C24A4} = {1E3DC445-B328-491C-98D8-50C7F85C24A4} 10 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396} = {1D94E4A4-D645-48FD-BAF6-AC711C70F396} 11 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA} = {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA} 12 | {69EA30FC-E07D-46AD-AA31-5D405318896F} = {69EA30FC-E07D-46AD-AA31-5D405318896F} 13 | EndProjectSection 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Unit-Tests", "VisualStudio\Unit-Tests.vcxproj", "{1E3DC445-B328-491C-98D8-50C7F85C24A4}" 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlib DLL VC142", "VisualStudio\dlib DLL VC142.vcxproj", "{69EA30FC-E07D-46AD-AA31-5D405318896F}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlib Static VC142", "VisualStudio\dlib Static VC142.vcxproj", "{1D94E4A4-D645-48FD-BAF6-AC711C70F396}" 20 | EndProject 21 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlib DLL VC142 XP", "VisualStudio\dlib DLL VC143.vcxproj", "{6BD7E43A-9F15-405F-B232-545F5C50F0FA}" 22 | EndProject 23 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlib Static VC142 XP", "VisualStudio\dlib Static VC143.vcxproj", "{BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}" 24 | EndProject 25 | Global 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|x64 = Debug|x64 28 | Debug|x86 = Debug|x86 29 | Release|x64 = Release|x64 30 | Release|x86 = Release|x86 31 | EndGlobalSection 32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 33 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Debug|x64.ActiveCfg = Debug|x64 34 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Debug|x64.Build.0 = Debug|x64 35 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Debug|x86.ActiveCfg = Debug|Win32 36 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Debug|x86.Build.0 = Debug|Win32 37 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Release|x64.ActiveCfg = Release|x64 38 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Release|x64.Build.0 = Release|x64 39 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Release|x86.ActiveCfg = Release|Win32 40 | {BD0914E5-DE40-4CB3-913B-077B97307F29}.Release|x86.Build.0 = Release|Win32 41 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Debug|x64.ActiveCfg = Debug|x64 42 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Debug|x64.Build.0 = Debug|x64 43 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Debug|x86.ActiveCfg = Debug|Win32 44 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Debug|x86.Build.0 = Debug|Win32 45 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Release|x64.ActiveCfg = Release|x64 46 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Release|x64.Build.0 = Release|x64 47 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Release|x86.ActiveCfg = Release|Win32 48 | {1E3DC445-B328-491C-98D8-50C7F85C24A4}.Release|x86.Build.0 = Release|Win32 49 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Debug|x64.ActiveCfg = Debug|x64 50 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Debug|x64.Build.0 = Debug|x64 51 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Debug|x86.ActiveCfg = Debug|Win32 52 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Debug|x86.Build.0 = Debug|Win32 53 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Release|x64.ActiveCfg = Release|x64 54 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Release|x64.Build.0 = Release|x64 55 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Release|x86.ActiveCfg = Release|Win32 56 | {69EA30FC-E07D-46AD-AA31-5D405318896F}.Release|x86.Build.0 = Release|Win32 57 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Debug|x64.ActiveCfg = Debug|x64 58 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Debug|x64.Build.0 = Debug|x64 59 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Debug|x86.ActiveCfg = Debug|Win32 60 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Debug|x86.Build.0 = Debug|Win32 61 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Release|x64.ActiveCfg = Release|x64 62 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Release|x64.Build.0 = Release|x64 63 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Release|x86.ActiveCfg = Release|Win32 64 | {1D94E4A4-D645-48FD-BAF6-AC711C70F396}.Release|x86.Build.0 = Release|Win32 65 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Debug|x64.ActiveCfg = Debug|x64 66 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Debug|x64.Build.0 = Debug|x64 67 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Debug|x86.ActiveCfg = Debug|Win32 68 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Debug|x86.Build.0 = Debug|Win32 69 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Release|x64.ActiveCfg = Release|x64 70 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Release|x64.Build.0 = Release|x64 71 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Release|x86.ActiveCfg = Release|Win32 72 | {6BD7E43A-9F15-405F-B232-545F5C50F0FA}.Release|x86.Build.0 = Release|Win32 73 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Debug|x64.ActiveCfg = Debug|x64 74 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Debug|x64.Build.0 = Debug|x64 75 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Debug|x86.ActiveCfg = Debug|Win32 76 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Debug|x86.Build.0 = Debug|Win32 77 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Release|x64.ActiveCfg = Release|x64 78 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Release|x64.Build.0 = Release|x64 79 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Release|x86.ActiveCfg = Release|Win32 80 | {BA6B1CC6-51DA-41D9-B26A-4B5449112BDA}.Release|x86.Build.0 = Release|Win32 81 | EndGlobalSection 82 | GlobalSection(SolutionProperties) = preSolution 83 | HideSolutionNode = FALSE 84 | EndGlobalSection 85 | GlobalSection(ExtensibilityGlobals) = postSolution 86 | SolutionGuid = {4352A90A-072C-4422-9CFC-8585A4CE6A26} 87 | EndGlobalSection 88 | EndGlobal 89 | -------------------------------------------------------------------------------- /dlib.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 052DE7CD206AB79800936046 /* libdlib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A602191B56EF4000C71A24 /* libdlib.a */; }; 11 | 052DE7D4206AB7C000936046 /* Mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 052DE7D3206AB7C000936046 /* Mac.cpp */; }; 12 | 052DE7DE206AB8D600936046 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 052DE7DA206AB8D500936046 /* libc++.tbd */; }; 13 | 0536385B21AFF8860015CFA9 /* XSTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0536385A21AFF87B0015CFA9 /* XSTest.framework */; }; 14 | 0564BCD71EF9A08800195C67 /* dlib-Manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0564BCD51EF99FE400195C67 /* dlib-Manager.cpp */; }; 15 | 0564BCD81EF9A0CF00195C67 /* dlib-Module.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0564BCD61EF99FE400195C67 /* dlib-Module.cpp */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 052DE7CE206AB79800936046 /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = 05A602111B56EF4000C71A24 /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = 05A602181B56EF4000C71A24; 24 | remoteInfo = dlib; 25 | }; 26 | 0536385921AFF87B0015CFA9 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 0536385521AFF87B0015CFA9 /* XSTest.xcodeproj */; 29 | proxyType = 2; 30 | remoteGlobalIDString = 05D526E721A864BC0025CCEB; 31 | remoteInfo = XSTest; 32 | }; 33 | 0536385C21AFF88A0015CFA9 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 0536385521AFF87B0015CFA9 /* XSTest.xcodeproj */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 05D526E621A864BC0025CCEB; 38 | remoteInfo = XSTest; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 05287BE81EF9B470003A79D5 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 44 | 052DE7C8206AB79800936046 /* Unit-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 052DE7CC206AB79800936046 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 052DE7D3206AB7C000936046 /* Mac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Mac.cpp; sourceTree = ""; }; 47 | 052DE7DA206AB8D500936046 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; 48 | 0536385521AFF87B0015CFA9 /* XSTest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = XSTest.xcodeproj; path = Submodules/XSTest/XSTest.xcodeproj; sourceTree = ""; }; 49 | 0564BCD31EF99E0900195C67 /* dlib-Module.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = "dlib-Module.hpp"; sourceTree = ""; }; 50 | 0564BCD41EF99E0900195C67 /* dlib-Manager.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = "dlib-Manager.hpp"; sourceTree = ""; }; 51 | 0564BCD51EF99FE400195C67 /* dlib-Manager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "dlib-Manager.cpp"; sourceTree = ""; }; 52 | 0564BCD61EF99FE400195C67 /* dlib-Module.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "dlib-Module.cpp"; sourceTree = ""; }; 53 | 057223DE20111DD200DC0502 /* Release - ccache.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Release - ccache.xcconfig"; sourceTree = ""; }; 54 | 057223DF20111DD200DC0502 /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = ""; }; 55 | 057223E020111DD200DC0502 /* Debug - ccache.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Debug - ccache.xcconfig"; sourceTree = ""; }; 56 | 057223E120111DD200DC0502 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 57 | 057223E220111DD200DC0502 /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 58 | 057223E320111DD200DC0502 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 59 | 057223E520111DD200DC0502 /* Signing.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Signing.xcconfig; sourceTree = ""; }; 60 | 057223E620111DD200DC0502 /* Architectures.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Architectures.xcconfig; sourceTree = ""; }; 61 | 057223E820111DD200DC0502 /* Issues.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Issues.xcconfig; sourceTree = ""; }; 62 | 057223EA20111DD200DC0502 /* Apple-APIs.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apple-APIs.xcconfig"; sourceTree = ""; }; 63 | 057223EB20111DD200DC0502 /* Generic-Issues.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Generic-Issues.xcconfig"; sourceTree = ""; }; 64 | 057223EC20111DD200DC0502 /* Security.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Security.xcconfig; sourceTree = ""; }; 65 | 057223ED20111DD200DC0502 /* Objective-C.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Objective-C.xcconfig"; sourceTree = ""; }; 66 | 057223EE20111DD200DC0502 /* Analysis-Policy.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Analysis-Policy.xcconfig"; sourceTree = ""; }; 67 | 057223EF20111DD200DC0502 /* Deployment.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Deployment.xcconfig; sourceTree = ""; }; 68 | 057223F020111DD200DC0502 /* Build-Options.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Build-Options.xcconfig"; sourceTree = ""; }; 69 | 057223F120111DD200DC0502 /* Swift-Compiler.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Swift-Compiler.xcconfig"; sourceTree = ""; }; 70 | 057223F220111DD200DC0502 /* Static-Analyzer.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Static-Analyzer.xcconfig"; sourceTree = ""; }; 71 | 057223F420111DD200DC0502 /* Warnings-Policies.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Warnings-Policies.xcconfig"; sourceTree = ""; }; 72 | 057223F520111DD200DC0502 /* Code-Generation.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Code-Generation.xcconfig"; sourceTree = ""; }; 73 | 057223F620111DD200DC0502 /* Language.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Language.xcconfig; sourceTree = ""; }; 74 | 057223F720111DD200DC0502 /* General.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = General.xcconfig; sourceTree = ""; }; 75 | 057223F820111DD200DC0502 /* Search-Paths.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Search-Paths.xcconfig"; sourceTree = ""; }; 76 | 057223F920111DD200DC0502 /* Apple-LLVM.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Apple-LLVM.xcconfig"; sourceTree = ""; }; 77 | 057223FC20111DD200DC0502 /* Modules.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Modules.xcconfig; sourceTree = ""; }; 78 | 057223FD20111DD200DC0502 /* Objective-C.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Objective-C.xcconfig"; sourceTree = ""; }; 79 | 057223FE20111DD200DC0502 /* C++.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "C++.xcconfig"; sourceTree = ""; }; 80 | 057223FF20111DD200DC0502 /* Code-Generation.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Code-Generation.xcconfig"; sourceTree = ""; }; 81 | 0572240020111DD200DC0502 /* Address-Sanitizer.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Address-Sanitizer.xcconfig"; sourceTree = ""; }; 82 | 0572240120111DD200DC0502 /* Language.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Language.xcconfig; sourceTree = ""; }; 83 | 0572240220111DD200DC0502 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 84 | 0572240320111DD200DC0502 /* Undefined-Behavior-Sanitizer.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Undefined-Behavior-Sanitizer.xcconfig"; sourceTree = ""; }; 85 | 0572240420111DD200DC0502 /* Warning-Policies.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Warning-Policies.xcconfig"; sourceTree = ""; }; 86 | 0572240620111DD200DC0502 /* Objective-C-ARC.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Objective-C-ARC.xcconfig"; sourceTree = ""; }; 87 | 0572240720111DD200DC0502 /* Objective-C.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Objective-C.xcconfig"; sourceTree = ""; }; 88 | 0572240820111DD200DC0502 /* C++.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "C++.xcconfig"; sourceTree = ""; }; 89 | 0572240920111DD200DC0502 /* All-Languages.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "All-Languages.xcconfig"; sourceTree = ""; }; 90 | 0572240A20111DD200DC0502 /* Preprocessing.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Preprocessing.xcconfig; sourceTree = ""; }; 91 | 0572240D20111DD200DC0502 /* ccache-config.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "ccache-config.sh"; sourceTree = ""; }; 92 | 0572240E20111DD200DC0502 /* ccache.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ccache.sh; sourceTree = ""; }; 93 | 05A602191B56EF4000C71A24 /* libdlib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdlib.a; sourceTree = BUILT_PRODUCTS_DIR; }; 94 | 05A602231B56EF9D00C71A24 /* dlib-macros.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = "dlib-macros.hpp"; sourceTree = ""; }; 95 | 05A602241B56EF9D00C71A24 /* dlib-private-macros.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = "dlib-private-macros.hpp"; sourceTree = ""; }; 96 | 05A602271B56EF9D00C71A24 /* dlib.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = dlib.hpp; sourceTree = ""; }; 97 | /* End PBXFileReference section */ 98 | 99 | /* Begin PBXFrameworksBuildPhase section */ 100 | 052DE7C5206AB79700936046 /* Frameworks */ = { 101 | isa = PBXFrameworksBuildPhase; 102 | buildActionMask = 2147483647; 103 | files = ( 104 | 0536385B21AFF8860015CFA9 /* XSTest.framework in Frameworks */, 105 | 052DE7DE206AB8D600936046 /* libc++.tbd in Frameworks */, 106 | 052DE7CD206AB79800936046 /* libdlib.a in Frameworks */, 107 | ); 108 | runOnlyForDeploymentPostprocessing = 0; 109 | }; 110 | 05A602161B56EF4000C71A24 /* Frameworks */ = { 111 | isa = PBXFrameworksBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | ); 115 | runOnlyForDeploymentPostprocessing = 0; 116 | }; 117 | /* End PBXFrameworksBuildPhase section */ 118 | 119 | /* Begin PBXGroup section */ 120 | 052DE7C9206AB79800936046 /* Unit-Tests */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 052DE7D3206AB7C000936046 /* Mac.cpp */, 124 | 052DE7CC206AB79800936046 /* Info.plist */, 125 | ); 126 | path = "Unit-Tests"; 127 | sourceTree = ""; 128 | }; 129 | 052DE7D5206AB83F00936046 /* Frameworks */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 052DE7DA206AB8D500936046 /* libc++.tbd */, 133 | ); 134 | name = Frameworks; 135 | sourceTree = ""; 136 | }; 137 | 0536385621AFF87B0015CFA9 /* Products */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 0536385A21AFF87B0015CFA9 /* XSTest.framework */, 141 | ); 142 | name = Products; 143 | sourceTree = ""; 144 | }; 145 | 057223DD20111DD200DC0502 /* xcconfig */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 057223DE20111DD200DC0502 /* Release - ccache.xcconfig */, 149 | 057223DF20111DD200DC0502 /* Common.xcconfig */, 150 | 057223E020111DD200DC0502 /* Debug - ccache.xcconfig */, 151 | 057223E120111DD200DC0502 /* Debug.xcconfig */, 152 | 057223E220111DD200DC0502 /* Release.xcconfig */, 153 | 057223E320111DD200DC0502 /* README.md */, 154 | 057223E420111DD200DC0502 /* Common */, 155 | 0572240C20111DD200DC0502 /* Scripts */, 156 | ); 157 | name = xcconfig; 158 | path = Submodules/xcconfig; 159 | sourceTree = ""; 160 | }; 161 | 057223E420111DD200DC0502 /* Common */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 057223E520111DD200DC0502 /* Signing.xcconfig */, 165 | 057223E620111DD200DC0502 /* Architectures.xcconfig */, 166 | 057223E720111DD200DC0502 /* Static-Analyzer */, 167 | 057223EF20111DD200DC0502 /* Deployment.xcconfig */, 168 | 057223F020111DD200DC0502 /* Build-Options.xcconfig */, 169 | 057223F120111DD200DC0502 /* Swift-Compiler.xcconfig */, 170 | 057223F220111DD200DC0502 /* Static-Analyzer.xcconfig */, 171 | 057223F320111DD200DC0502 /* Swift-Compiler */, 172 | 057223F820111DD200DC0502 /* Search-Paths.xcconfig */, 173 | 057223F920111DD200DC0502 /* Apple-LLVM.xcconfig */, 174 | 057223FA20111DD200DC0502 /* Apple-LLVM */, 175 | ); 176 | path = Common; 177 | sourceTree = ""; 178 | }; 179 | 057223E720111DD200DC0502 /* Static-Analyzer */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | 057223E820111DD200DC0502 /* Issues.xcconfig */, 183 | 057223E920111DD200DC0502 /* Issues */, 184 | ); 185 | path = "Static-Analyzer"; 186 | sourceTree = ""; 187 | }; 188 | 057223E920111DD200DC0502 /* Issues */ = { 189 | isa = PBXGroup; 190 | children = ( 191 | 057223EA20111DD200DC0502 /* Apple-APIs.xcconfig */, 192 | 057223EB20111DD200DC0502 /* Generic-Issues.xcconfig */, 193 | 057223EC20111DD200DC0502 /* Security.xcconfig */, 194 | 057223ED20111DD200DC0502 /* Objective-C.xcconfig */, 195 | 057223EE20111DD200DC0502 /* Analysis-Policy.xcconfig */, 196 | ); 197 | path = Issues; 198 | sourceTree = ""; 199 | }; 200 | 057223F320111DD200DC0502 /* Swift-Compiler */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 057223F420111DD200DC0502 /* Warnings-Policies.xcconfig */, 204 | 057223F520111DD200DC0502 /* Code-Generation.xcconfig */, 205 | 057223F620111DD200DC0502 /* Language.xcconfig */, 206 | 057223F720111DD200DC0502 /* General.xcconfig */, 207 | ); 208 | path = "Swift-Compiler"; 209 | sourceTree = ""; 210 | }; 211 | 057223FA20111DD200DC0502 /* Apple-LLVM */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 057223FB20111DD200DC0502 /* Language */, 215 | 057223FF20111DD200DC0502 /* Code-Generation.xcconfig */, 216 | 0572240020111DD200DC0502 /* Address-Sanitizer.xcconfig */, 217 | 0572240120111DD200DC0502 /* Language.xcconfig */, 218 | 0572240220111DD200DC0502 /* Warnings.xcconfig */, 219 | 0572240320111DD200DC0502 /* Undefined-Behavior-Sanitizer.xcconfig */, 220 | 0572240420111DD200DC0502 /* Warning-Policies.xcconfig */, 221 | 0572240520111DD200DC0502 /* Warnings */, 222 | 0572240A20111DD200DC0502 /* Preprocessing.xcconfig */, 223 | ); 224 | path = "Apple-LLVM"; 225 | sourceTree = ""; 226 | }; 227 | 057223FB20111DD200DC0502 /* Language */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 057223FC20111DD200DC0502 /* Modules.xcconfig */, 231 | 057223FD20111DD200DC0502 /* Objective-C.xcconfig */, 232 | 057223FE20111DD200DC0502 /* C++.xcconfig */, 233 | ); 234 | path = Language; 235 | sourceTree = ""; 236 | }; 237 | 0572240520111DD200DC0502 /* Warnings */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | 0572240620111DD200DC0502 /* Objective-C-ARC.xcconfig */, 241 | 0572240720111DD200DC0502 /* Objective-C.xcconfig */, 242 | 0572240820111DD200DC0502 /* C++.xcconfig */, 243 | 0572240920111DD200DC0502 /* All-Languages.xcconfig */, 244 | ); 245 | path = Warnings; 246 | sourceTree = ""; 247 | }; 248 | 0572240C20111DD200DC0502 /* Scripts */ = { 249 | isa = PBXGroup; 250 | children = ( 251 | 0572240D20111DD200DC0502 /* ccache-config.sh */, 252 | 0572240E20111DD200DC0502 /* ccache.sh */, 253 | ); 254 | path = Scripts; 255 | sourceTree = ""; 256 | }; 257 | 05A602101B56EF4000C71A24 = { 258 | isa = PBXGroup; 259 | children = ( 260 | 0536385521AFF87B0015CFA9 /* XSTest.xcodeproj */, 261 | 05287BE81EF9B470003A79D5 /* README.md */, 262 | 057223DD20111DD200DC0502 /* xcconfig */, 263 | 05A602201B56EF9D00C71A24 /* dlib */, 264 | 052DE7C9206AB79800936046 /* Unit-Tests */, 265 | 05A6021A1B56EF4000C71A24 /* Products */, 266 | 052DE7D5206AB83F00936046 /* Frameworks */, 267 | ); 268 | sourceTree = ""; 269 | }; 270 | 05A6021A1B56EF4000C71A24 /* Products */ = { 271 | isa = PBXGroup; 272 | children = ( 273 | 05A602191B56EF4000C71A24 /* libdlib.a */, 274 | 052DE7C8206AB79800936046 /* Unit-Tests.xctest */, 275 | ); 276 | name = Products; 277 | sourceTree = ""; 278 | }; 279 | 05A602201B56EF9D00C71A24 /* dlib */ = { 280 | isa = PBXGroup; 281 | children = ( 282 | 05A602211B56EF9D00C71A24 /* include */, 283 | 05A602281B56EF9D00C71A24 /* source */, 284 | ); 285 | path = dlib; 286 | sourceTree = ""; 287 | }; 288 | 05A602211B56EF9D00C71A24 /* include */ = { 289 | isa = PBXGroup; 290 | children = ( 291 | 05A602231B56EF9D00C71A24 /* dlib-macros.hpp */, 292 | 05A602241B56EF9D00C71A24 /* dlib-private-macros.hpp */, 293 | 05A602271B56EF9D00C71A24 /* dlib.hpp */, 294 | 0564BCD41EF99E0900195C67 /* dlib-Manager.hpp */, 295 | 0564BCD31EF99E0900195C67 /* dlib-Module.hpp */, 296 | ); 297 | path = include; 298 | sourceTree = ""; 299 | }; 300 | 05A602281B56EF9D00C71A24 /* source */ = { 301 | isa = PBXGroup; 302 | children = ( 303 | 0564BCD51EF99FE400195C67 /* dlib-Manager.cpp */, 304 | 0564BCD61EF99FE400195C67 /* dlib-Module.cpp */, 305 | ); 306 | path = source; 307 | sourceTree = ""; 308 | }; 309 | /* End PBXGroup section */ 310 | 311 | /* Begin PBXHeadersBuildPhase section */ 312 | 05A602171B56EF4000C71A24 /* Headers */ = { 313 | isa = PBXHeadersBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | /* End PBXHeadersBuildPhase section */ 320 | 321 | /* Begin PBXNativeTarget section */ 322 | 052DE7C7206AB79700936046 /* Unit-Tests */ = { 323 | isa = PBXNativeTarget; 324 | buildConfigurationList = 052DE7D0206AB79800936046 /* Build configuration list for PBXNativeTarget "Unit-Tests" */; 325 | buildPhases = ( 326 | 052DE7C4206AB79700936046 /* Sources */, 327 | 052DE7C5206AB79700936046 /* Frameworks */, 328 | 052DE7C6206AB79700936046 /* Resources */, 329 | ); 330 | buildRules = ( 331 | ); 332 | dependencies = ( 333 | 0536385D21AFF88A0015CFA9 /* PBXTargetDependency */, 334 | 052DE7CF206AB79800936046 /* PBXTargetDependency */, 335 | ); 336 | name = "Unit-Tests"; 337 | productName = "Unit-Tests"; 338 | productReference = 052DE7C8206AB79800936046 /* Unit-Tests.xctest */; 339 | productType = "com.apple.product-type.bundle.unit-test"; 340 | }; 341 | 05A602181B56EF4000C71A24 /* dlib */ = { 342 | isa = PBXNativeTarget; 343 | buildConfigurationList = 05A6021D1B56EF4000C71A24 /* Build configuration list for PBXNativeTarget "dlib" */; 344 | buildPhases = ( 345 | 05A602151B56EF4000C71A24 /* Sources */, 346 | 05A602161B56EF4000C71A24 /* Frameworks */, 347 | 05A602171B56EF4000C71A24 /* Headers */, 348 | ); 349 | buildRules = ( 350 | ); 351 | dependencies = ( 352 | ); 353 | name = dlib; 354 | productName = dlib; 355 | productReference = 05A602191B56EF4000C71A24 /* libdlib.a */; 356 | productType = "com.apple.product-type.library.static"; 357 | }; 358 | /* End PBXNativeTarget section */ 359 | 360 | /* Begin PBXProject section */ 361 | 05A602111B56EF4000C71A24 /* Project object */ = { 362 | isa = PBXProject; 363 | attributes = { 364 | LastUpgradeCheck = 0900; 365 | ORGANIZATIONNAME = "XS-Labs"; 366 | TargetAttributes = { 367 | 052DE7C7206AB79700936046 = { 368 | CreatedOnToolsVersion = 9.2; 369 | DevelopmentTeam = 326Y53CJMD; 370 | ProvisioningStyle = Automatic; 371 | }; 372 | 05A602181B56EF4000C71A24 = { 373 | CreatedOnToolsVersion = 7.0; 374 | DevelopmentTeam = 326Y53CJMD; 375 | ProvisioningStyle = Automatic; 376 | }; 377 | }; 378 | }; 379 | buildConfigurationList = 05A602141B56EF4000C71A24 /* Build configuration list for PBXProject "dlib" */; 380 | compatibilityVersion = "Xcode 3.2"; 381 | developmentRegion = en; 382 | hasScannedForEncodings = 0; 383 | knownRegions = ( 384 | en, 385 | Base, 386 | ); 387 | mainGroup = 05A602101B56EF4000C71A24; 388 | productRefGroup = 05A6021A1B56EF4000C71A24 /* Products */; 389 | projectDirPath = ""; 390 | projectReferences = ( 391 | { 392 | ProductGroup = 0536385621AFF87B0015CFA9 /* Products */; 393 | ProjectRef = 0536385521AFF87B0015CFA9 /* XSTest.xcodeproj */; 394 | }, 395 | ); 396 | projectRoot = ""; 397 | targets = ( 398 | 05A602181B56EF4000C71A24 /* dlib */, 399 | 052DE7C7206AB79700936046 /* Unit-Tests */, 400 | ); 401 | }; 402 | /* End PBXProject section */ 403 | 404 | /* Begin PBXReferenceProxy section */ 405 | 0536385A21AFF87B0015CFA9 /* XSTest.framework */ = { 406 | isa = PBXReferenceProxy; 407 | fileType = wrapper.framework; 408 | path = XSTest.framework; 409 | remoteRef = 0536385921AFF87B0015CFA9 /* PBXContainerItemProxy */; 410 | sourceTree = BUILT_PRODUCTS_DIR; 411 | }; 412 | /* End PBXReferenceProxy section */ 413 | 414 | /* Begin PBXResourcesBuildPhase section */ 415 | 052DE7C6206AB79700936046 /* Resources */ = { 416 | isa = PBXResourcesBuildPhase; 417 | buildActionMask = 2147483647; 418 | files = ( 419 | ); 420 | runOnlyForDeploymentPostprocessing = 0; 421 | }; 422 | /* End PBXResourcesBuildPhase section */ 423 | 424 | /* Begin PBXSourcesBuildPhase section */ 425 | 052DE7C4206AB79700936046 /* Sources */ = { 426 | isa = PBXSourcesBuildPhase; 427 | buildActionMask = 2147483647; 428 | files = ( 429 | 052DE7D4206AB7C000936046 /* Mac.cpp in Sources */, 430 | ); 431 | runOnlyForDeploymentPostprocessing = 0; 432 | }; 433 | 05A602151B56EF4000C71A24 /* Sources */ = { 434 | isa = PBXSourcesBuildPhase; 435 | buildActionMask = 2147483647; 436 | files = ( 437 | 0564BCD81EF9A0CF00195C67 /* dlib-Module.cpp in Sources */, 438 | 0564BCD71EF9A08800195C67 /* dlib-Manager.cpp in Sources */, 439 | ); 440 | runOnlyForDeploymentPostprocessing = 0; 441 | }; 442 | /* End PBXSourcesBuildPhase section */ 443 | 444 | /* Begin PBXTargetDependency section */ 445 | 052DE7CF206AB79800936046 /* PBXTargetDependency */ = { 446 | isa = PBXTargetDependency; 447 | target = 05A602181B56EF4000C71A24 /* dlib */; 448 | targetProxy = 052DE7CE206AB79800936046 /* PBXContainerItemProxy */; 449 | }; 450 | 0536385D21AFF88A0015CFA9 /* PBXTargetDependency */ = { 451 | isa = PBXTargetDependency; 452 | name = XSTest; 453 | targetProxy = 0536385C21AFF88A0015CFA9 /* PBXContainerItemProxy */; 454 | }; 455 | /* End PBXTargetDependency section */ 456 | 457 | /* Begin XCBuildConfiguration section */ 458 | 052DE7D1206AB79800936046 /* Debug */ = { 459 | isa = XCBuildConfiguration; 460 | buildSettings = { 461 | HEADER_SEARCH_PATHS = "$(SRCROOT)/dlib/include"; 462 | INFOPLIST_FILE = "Unit-Tests/Info.plist"; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 464 | PRODUCT_BUNDLE_IDENTIFIER = "com.xs-labs.Unit-Tests"; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | }; 467 | name = Debug; 468 | }; 469 | 052DE7D2206AB79800936046 /* Release */ = { 470 | isa = XCBuildConfiguration; 471 | buildSettings = { 472 | HEADER_SEARCH_PATHS = "$(SRCROOT)/dlib/include"; 473 | INFOPLIST_FILE = "Unit-Tests/Info.plist"; 474 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 475 | PRODUCT_BUNDLE_IDENTIFIER = "com.xs-labs.Unit-Tests"; 476 | PRODUCT_NAME = "$(TARGET_NAME)"; 477 | }; 478 | name = Release; 479 | }; 480 | 05A6021B1B56EF4000C71A24 /* Debug */ = { 481 | isa = XCBuildConfiguration; 482 | baseConfigurationReference = 057223E020111DD200DC0502 /* Debug - ccache.xcconfig */; 483 | buildSettings = { 484 | MACOSX_DEPLOYMENT_TARGET = 10.10; 485 | }; 486 | name = Debug; 487 | }; 488 | 05A6021C1B56EF4000C71A24 /* Release */ = { 489 | isa = XCBuildConfiguration; 490 | baseConfigurationReference = 057223DE20111DD200DC0502 /* Release - ccache.xcconfig */; 491 | buildSettings = { 492 | MACOSX_DEPLOYMENT_TARGET = 10.10; 493 | }; 494 | name = Release; 495 | }; 496 | 05A6021E1B56EF4000C71A24 /* Debug */ = { 497 | isa = XCBuildConfiguration; 498 | buildSettings = { 499 | EXECUTABLE_PREFIX = lib; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | SKIP_INSTALL = YES; 502 | }; 503 | name = Debug; 504 | }; 505 | 05A6021F1B56EF4000C71A24 /* Release */ = { 506 | isa = XCBuildConfiguration; 507 | buildSettings = { 508 | EXECUTABLE_PREFIX = lib; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | SKIP_INSTALL = YES; 511 | }; 512 | name = Release; 513 | }; 514 | /* End XCBuildConfiguration section */ 515 | 516 | /* Begin XCConfigurationList section */ 517 | 052DE7D0206AB79800936046 /* Build configuration list for PBXNativeTarget "Unit-Tests" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 052DE7D1206AB79800936046 /* Debug */, 521 | 052DE7D2206AB79800936046 /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 05A602141B56EF4000C71A24 /* Build configuration list for PBXProject "dlib" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 05A6021B1B56EF4000C71A24 /* Debug */, 530 | 05A6021C1B56EF4000C71A24 /* Release */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | defaultConfigurationName = Release; 534 | }; 535 | 05A6021D1B56EF4000C71A24 /* Build configuration list for PBXNativeTarget "dlib" */ = { 536 | isa = XCConfigurationList; 537 | buildConfigurations = ( 538 | 05A6021E1B56EF4000C71A24 /* Debug */, 539 | 05A6021F1B56EF4000C71A24 /* Release */, 540 | ); 541 | defaultConfigurationIsVisible = 0; 542 | defaultConfigurationName = Release; 543 | }; 544 | /* End XCConfigurationList section */ 545 | }; 546 | rootObject = 05A602111B56EF4000C71A24 /* Project object */; 547 | } 548 | -------------------------------------------------------------------------------- /dlib.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dlib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /dlib.xcodeproj/xcshareddata/xcschemes/dlib.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 38 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 65 | 66 | 72 | 73 | 74 | 75 | 81 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /dlib/include/dlib-Manager.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @header dlib-Manager.hpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #ifndef DLIB_MANAGER_HPP 31 | #define DLIB_MANAGER_HPP 32 | 33 | #include 34 | 35 | namespace dlib 36 | { 37 | class Module; 38 | 39 | class Manager 40 | { 41 | public: 42 | 43 | #ifdef _WIN32 44 | static Manager & __cdecl SharedInstance( void ); 45 | #else 46 | static Manager & SharedInstance( void ); 47 | #endif 48 | 49 | Manager( void ); 50 | Manager( const Manager & o ); 51 | ~Manager( void ); 52 | 53 | Manager & operator =( Manager o ); 54 | 55 | void AddSearchPath( const std::string & path ); 56 | Module * GetModule( const std::string & name ); 57 | 58 | friend void swap( Manager & o1, Manager & o2 ); 59 | 60 | private: 61 | 62 | class IMPL; 63 | IMPL * impl; 64 | }; 65 | } 66 | 67 | #endif /* DLIB_MANAGER_HPP */ 68 | -------------------------------------------------------------------------------- /dlib/include/dlib-Module.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @header dlib-Module.hpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #ifndef DLIB_MODULE_HPP 31 | #define DLIB_MODULE_HPP 32 | 33 | #include 34 | 35 | namespace dlib 36 | { 37 | class Module 38 | { 39 | public: 40 | 41 | Module( const std::string & path ); 42 | Module( const Module & o ); 43 | ~Module( void ); 44 | 45 | Module & operator =( Module o ); 46 | 47 | void * GetSymbolAddress( const std::string & name ); 48 | 49 | friend void swap( Module & o1, Module & o2 ); 50 | 51 | private: 52 | 53 | class IMPL; 54 | IMPL * impl; 55 | }; 56 | } 57 | 58 | #endif /* DLIB_MODULE_HPP */ 59 | 60 | -------------------------------------------------------------------------------- /dlib/include/dlib-macros.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @header dlib-macros.hpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #ifndef DLIB_MACROS_HPP 31 | #define DLIB_MACROS_HPP 32 | 33 | #define DLIB_VAR( _module_, _type_, _name_, _default_ ) DLIB_PRIVATE_VAR( _module_, _type_, _name_, _default_ ) 34 | #define DLIB_FUNC_START( _module_, _ret_, _name_, ... ) DLIB_PRIVATE_FUNC_START( _module_, _ret_, _name_, __VA_ARGS__ ) 35 | #define DLIB_FUNC_RET( _module_, _ret_, _name_, ... ) DLIB_PRIVATE_FUNC_RET( _module_, _ret_, _name_, __VA_ARGS__ ) 36 | #define DLIB_FUNC_NORET( _module_, _ret_, _name_, ... ) DLIB_PRIVATE_FUNC_NORET( _module_, _ret_, _name_, __VA_ARGS__ ) 37 | #define DLIB_CONSTRUCTOR( _name_ ) DLIB_PRIVATE_CONSTRUCTOR( _name_ ) 38 | 39 | #endif /* DLIB_MACROS_HPP */ 40 | -------------------------------------------------------------------------------- /dlib/include/dlib-private-macros.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @header dlib-private-macros.hpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #ifndef DLIB_PRIVATE_MACROS_HPP 31 | #define DLIB_PRIVATE_MACROS_HPP 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | #ifndef DLIB_S 38 | #define DLIB_S( _s_ ) _s_ 39 | #endif 40 | 41 | #ifdef _MSC_VER 42 | 43 | #pragma section( ".CRT$XCU", read ) 44 | 45 | #define DLIB_PRIVATE_CONSTRUCTOR( _name_ ) static void __cdecl _name_( void ); \ 46 | __declspec( allocate( ".CRT$XCU" ) ) void ( __cdecl * _name_ ## _ )( void ) = _name_; \ 47 | static void __cdecl _name_( void ) 48 | 49 | #else 50 | 51 | #define DLIB_PRIVATE_CONSTRUCTOR( _name_ ) static void _name_( void ) __attribute__( ( constructor ) ); \ 52 | static void _name_( void ) 53 | 54 | #endif 55 | 56 | #ifdef DEBUG 57 | 58 | #define DLIB_PRIVATE_WARN_MISSING_MODULE( _module_ ) std::cerr << "!!! DLIB WARNING - Missing Module: " << _module_ << std::endl 59 | #define DLIB_PRIVATE_WARN_MISSING_VAR( _type_, _module_, _name_ ) std::cerr << "!!! DLIB WARNING - Missing Symbol: " << _type_ << " " << _module_ << "." << _name_ << std::endl 60 | #define DLIB_PRIVATE_WARN_MISSING_FUNC( _module_, _ret_, _name_, _args_ ) std::cerr << "!!! DLIB WARNING - Missing Symbol: " << _ret_ << " " << _module_ << "." << _name_ << "( " << _args_ << " )" << std::endl 61 | 62 | #else 63 | 64 | #define DLIB_PRIVATE_WARN_MISSING_MODULE( _module_ ) 65 | #define DLIB_PRIVATE_WARN_MISSING_VAR( _type_, _module_, _name_ ) 66 | #define DLIB_PRIVATE_WARN_MISSING_FUNC( _type_, _module_, _name_, _args_ ) 67 | 68 | #endif 69 | 70 | #define DLIB_PRIVATE_VAR( _module_, _type_, _name_, _default_ ) _type_ _name_; \ 71 | \ 72 | DLIB_CONSTRUCTOR( __DLib_Constructor_Var_ ## _module_ ## _ ## _type_ ## _ ## _name_ ) \ 73 | { \ 74 | dlib::Module * module; \ 75 | \ 76 | module = dlib::Manager::SharedInstance().GetModule( DLIB_S( # _module_ ) ); \ 77 | \ 78 | if( module == nullptr ) \ 79 | { \ 80 | DLIB_PRIVATE_WARN_MISSING_MODULE( DLIB_S( # _module_ ) ); \ 81 | \ 82 | _name_ = _default_; \ 83 | } \ 84 | else if( module->GetSymbolAddress( DLIB_S( # _name_ ) ) == nullptr ) \ 85 | { \ 86 | DLIB_PRIVATE_WARN_MISSING_VAR( DLIB_S( # _type_ ), DLIB_S( # _module_ ), DLIB_S( # _name_ ) ); \ 87 | \ 88 | _name_ = _default_; \ 89 | } \ 90 | else \ 91 | { \ 92 | _name_ = *( reinterpret_cast< _type_ * >( module->GetSymbolAddress( DLIB_S( # _name_ ) ) ) ); \ 93 | } \ 94 | } 95 | 96 | #define DLIB_PRIVATE_FUNC_START( _module_, _ret_, _name_, ... ) _ret_ _name_( __VA_ARGS__ ) \ 97 | { \ 98 | static _ret_ ( * f )( __VA_ARGS__ ) = nullptr; \ 99 | static std::once_flag once; \ 100 | \ 101 | std::call_once \ 102 | ( \ 103 | once, \ 104 | [ & ] \ 105 | { \ 106 | dlib::Module * module; \ 107 | \ 108 | module = dlib::Manager::SharedInstance().GetModule( DLIB_S( # _module_ ) ); \ 109 | \ 110 | if( module == nullptr ) \ 111 | { \ 112 | DLIB_PRIVATE_WARN_MISSING_MODULE( DLIB_S( # _module_ ) ); \ 113 | } \ 114 | else \ 115 | { \ 116 | f = reinterpret_cast< _ret_ ( * )( __VA_ARGS__ ) > \ 117 | ( \ 118 | module->GetSymbolAddress( DLIB_S( # _name_ ) ) \ 119 | ); \ 120 | \ 121 | if( f == nullptr ) \ 122 | { \ 123 | DLIB_PRIVATE_WARN_MISSING_FUNC( DLIB_S( # _module_ ), DLIB_S( # _ret_ ), DLIB_S( # _name_ ), DLIB_S( # __VA_ARGS__ ) ); \ 124 | } \ 125 | } \ 126 | } \ 127 | ); 128 | 129 | #define DLIB_PRIVATE_FUNC_RET( _module_, _ret_, _name_, ... ) if( f == nullptr ) \ 130 | { \ 131 | return {}; \ 132 | } \ 133 | \ 134 | return f( __VA_ARGS__ ); \ 135 | } 136 | 137 | #define DLIB_PRIVATE_FUNC_NORET( _module_, _ret_, _name_, ... ) if( f == nullptr ) \ 138 | { \ 139 | return; \ 140 | } \ 141 | \ 142 | f( __VA_ARGS__ ); \ 143 | } 144 | 145 | #endif /* DLIB_PRIVATE_MACROS_HPP */ 146 | -------------------------------------------------------------------------------- /dlib/include/dlib.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @header dlib.hpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #ifndef DLIB_HPP 31 | #define DLIB_HPP 32 | 33 | #include "dlib-macros.hpp" 34 | #include "dlib-private-macros.hpp" 35 | #include "dlib-Manager.hpp" 36 | #include "dlib-Module.hpp" 37 | 38 | #endif /* DLIB_HPP */ 39 | -------------------------------------------------------------------------------- /dlib/source/dlib-Manager.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @file dlib-Manager.cpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #include "dlib-Manager.hpp" 31 | #include "dlib-Module.hpp" 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #ifdef _WIN32 39 | #include 40 | #endif 41 | 42 | namespace dlib 43 | { 44 | class Manager::IMPL 45 | { 46 | public: 47 | 48 | IMPL( void ); 49 | IMPL( const IMPL & o ); 50 | ~IMPL( void ); 51 | 52 | Module * CreateAndAddModule( const std::string & name, const std::string & path ); 53 | 54 | mutable std::recursive_mutex _rmtx; 55 | std::vector< std::string > _paths; 56 | std::map< std::string, Module * > _modules; 57 | }; 58 | 59 | static Manager * sharedManager = nullptr; 60 | 61 | #ifdef _WIN32 62 | Manager & __cdecl Manager::SharedInstance( void ) 63 | #else 64 | Manager & Manager::SharedInstance( void ) 65 | #endif 66 | { 67 | static std::once_flag once; 68 | 69 | std::call_once 70 | ( 71 | once, 72 | [ & ] 73 | { 74 | sharedManager = new Manager(); 75 | } 76 | ); 77 | 78 | return *( sharedManager ); 79 | } 80 | 81 | Manager::Manager( void ): impl( new IMPL() ) 82 | {} 83 | 84 | Manager::Manager( const Manager & o ): impl( new IMPL( *( o.impl ) ) ) 85 | {} 86 | 87 | Manager::~Manager( void ) 88 | { 89 | delete this->impl; 90 | } 91 | 92 | Manager & Manager::operator =( Manager o ) 93 | { 94 | swap( *( this ), o ); 95 | 96 | return *( this ); 97 | } 98 | 99 | void Manager::AddSearchPath( const std::string & path ) 100 | { 101 | std::lock_guard< std::recursive_mutex > l( this->impl->_rmtx ); 102 | 103 | #ifdef _WIN32 104 | { 105 | wchar_t * ws; 106 | int n; 107 | 108 | n = MultiByteToWideChar( CP_UTF8, 0, path.c_str(), -1, NULL, 0 ); 109 | ws = static_cast< wchar_t * >( malloc( ( ( size_t )n * sizeof( wchar_t ) ) + sizeof( wchar_t ) ) ); 110 | 111 | if( ws != NULL ) 112 | { 113 | MultiByteToWideChar( CP_UTF8, 0, path.c_str(), -1, ws, n ); 114 | 115 | /* 116 | * AddDllDirectory doesn't exist on Windows XP 117 | * AddDllDirectory( ws ); 118 | */ 119 | SetDllDirectory( ws ); 120 | free( ws ); 121 | } 122 | } 123 | #endif 124 | 125 | this->impl->_paths.push_back( path ); 126 | } 127 | 128 | Module * Manager::GetModule( const std::string & name ) 129 | { 130 | std::lock_guard< std::recursive_mutex > l( this->impl->_rmtx ); 131 | 132 | for( const auto & p: this->impl->_modules ) 133 | { 134 | if( p.first == name ) 135 | { 136 | return p.second; 137 | } 138 | } 139 | 140 | for( const auto & path: this->impl->_paths ) 141 | { 142 | { 143 | std::string lib; 144 | Module * module; 145 | 146 | #ifdef _WIN32 147 | 148 | lib = path; 149 | lib += "/"; 150 | lib += name; 151 | lib += ".dll"; 152 | 153 | module = this->impl->CreateAndAddModule( name, lib ); 154 | 155 | if( module ) 156 | { 157 | return module; 158 | } 159 | 160 | #else 161 | 162 | lib = path; 163 | lib += "/"; 164 | lib += name; 165 | lib += ".dylib"; 166 | 167 | module = this->impl->CreateAndAddModule( name, lib ); 168 | 169 | if( module != nullptr ) 170 | { 171 | return module; 172 | } 173 | 174 | lib = path; 175 | lib += "/"; 176 | lib += name; 177 | lib += ".framework"; 178 | lib += "/"; 179 | lib += name; 180 | 181 | module = this->impl->CreateAndAddModule( name, lib ); 182 | 183 | if( module != nullptr ) 184 | { 185 | return module; 186 | } 187 | 188 | #endif 189 | } 190 | } 191 | 192 | return nullptr; 193 | } 194 | 195 | void swap( Manager & o1, Manager & o2 ) 196 | { 197 | std::lock( o1.impl->_rmtx, o2.impl->_rmtx ); 198 | 199 | std::lock_guard< std::recursive_mutex > l1( o1.impl->_rmtx, std::adopt_lock ); 200 | std::lock_guard< std::recursive_mutex > l2( o2.impl->_rmtx, std::adopt_lock ); 201 | 202 | using std::swap; 203 | 204 | swap( o1.impl, o2.impl ); 205 | } 206 | 207 | Manager::IMPL::IMPL( void ) 208 | {} 209 | 210 | Manager::IMPL::IMPL( const IMPL & o ) 211 | { 212 | std::lock_guard< std::recursive_mutex > l( o._rmtx ); 213 | 214 | this->_paths = o._paths; 215 | 216 | for( const auto & p: o._modules ) 217 | { 218 | this->_modules[ p.first ] = new Module( *( p.second ) ); 219 | } 220 | } 221 | 222 | Manager::IMPL::~IMPL( void ) 223 | { 224 | for( const auto & p: this->_modules ) 225 | { 226 | delete p.second; 227 | } 228 | } 229 | 230 | Module * Manager::IMPL::CreateAndAddModule( const std::string & name, const std::string & path ) 231 | { 232 | std::lock_guard< std::recursive_mutex > l( this->_rmtx ); 233 | std::ifstream file( path.c_str() ); 234 | Module * module; 235 | 236 | if( file.good() ) 237 | { 238 | module = new Module( path ); 239 | 240 | this->_modules[ name ] = module; 241 | 242 | return module; 243 | } 244 | 245 | return nullptr; 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /dlib/source/dlib-Module.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2017 Jean-David Gadina - www.xs-labs.com 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | ******************************************************************************/ 24 | 25 | /*! 26 | * @file dlib-Module.cpp 27 | * @copyright (c) 2017, Jean-David Gadina - www.xs-labs.com 28 | */ 29 | 30 | #include "dlib-Module.hpp" 31 | #include 32 | #include 33 | #include 34 | 35 | #ifndef WIN32 36 | #include 37 | #else 38 | #include 39 | #include 40 | #include 41 | #endif 42 | 43 | namespace dlib 44 | { 45 | class Module::IMPL 46 | { 47 | public: 48 | 49 | IMPL( const std::string & path ); 50 | IMPL( const IMPL & o ); 51 | ~IMPL( void ); 52 | 53 | void * LoadAndAddSymbol( const std::string & name ); 54 | 55 | mutable std::recursive_mutex _rmtx; 56 | std::string _path; 57 | std::map< std::string, void * > _symbols; 58 | 59 | #ifdef _WIN32 60 | HMODULE _handle; 61 | #else 62 | void * _handle; 63 | #endif 64 | }; 65 | 66 | Module::Module( const std::string & path ): impl( new IMPL( path ) ) 67 | {} 68 | 69 | Module::Module( const Module & o ): impl( new IMPL( *( o.impl ) ) ) 70 | {} 71 | 72 | Module::~Module( void ) 73 | { 74 | delete this->impl; 75 | } 76 | 77 | Module & Module::operator =( Module o ) 78 | { 79 | swap( *( this ), o ); 80 | 81 | return *( this ); 82 | } 83 | 84 | void * Module::GetSymbolAddress( const std::string & name ) 85 | { 86 | std::lock_guard< std::recursive_mutex > l( this->impl->_rmtx ); 87 | 88 | for( const auto & p: this->impl->_symbols ) 89 | { 90 | if( p.first == name ) 91 | { 92 | return p.second; 93 | } 94 | } 95 | 96 | return this->impl->LoadAndAddSymbol( name ); 97 | } 98 | 99 | void swap( Module & o1, Module & o2 ) 100 | { 101 | std::lock( o1.impl->_rmtx, o2.impl->_rmtx ); 102 | 103 | std::lock_guard< std::recursive_mutex > l1( o1.impl->_rmtx, std::adopt_lock ); 104 | std::lock_guard< std::recursive_mutex > l2( o2.impl->_rmtx, std::adopt_lock ); 105 | 106 | using std::swap; 107 | 108 | swap( o1.impl, o2.impl ); 109 | } 110 | 111 | Module::IMPL::IMPL( const std::string & path ): 112 | _path( path ), 113 | _handle( nullptr ) 114 | {} 115 | 116 | Module::IMPL::IMPL( const IMPL & o ): 117 | _path( o._path ), 118 | _handle( nullptr ) 119 | {} 120 | 121 | Module::IMPL::~IMPL( void ) 122 | { 123 | if( this->_handle != nullptr ) 124 | { 125 | #ifdef _WIN32 126 | 127 | FreeLibrary( this->_handle ); 128 | 129 | #else 130 | 131 | dlclose( this->_handle ); 132 | 133 | #endif 134 | } 135 | } 136 | 137 | #ifdef _WIN32 138 | 139 | void * Module::IMPL::LoadAndAddSymbol( const std::string & name ) 140 | { 141 | std::lock_guard< std::recursive_mutex > l( this->_rmtx ); 142 | void * address; 143 | 144 | if( this->_handle == nullptr ) 145 | { 146 | { 147 | std::wstring_convert< std::codecvt_utf8_utf16< wchar_t > > c; 148 | std::wstring wpath; 149 | 150 | wpath = c.from_bytes( this->_path ); 151 | 152 | this->_handle = LoadLibrary( wpath.c_str() ); 153 | } 154 | 155 | if( this->_handle == nullptr ) 156 | { 157 | return nullptr; 158 | } 159 | } 160 | 161 | address = GetProcAddress( this->_handle, name.c_str() ); 162 | 163 | this->_symbols[ name ] = address; 164 | 165 | return address; 166 | } 167 | 168 | #else 169 | 170 | void * Module::IMPL::LoadAndAddSymbol( const std::string & name ) 171 | { 172 | std::lock_guard< std::recursive_mutex > l( this->_rmtx ); 173 | void * address; 174 | 175 | if( this->_handle == nullptr ) 176 | { 177 | this->_handle = dlopen( this->_path.c_str(), RTLD_LOCAL ); 178 | 179 | if( this->_handle == nullptr ) 180 | { 181 | return nullptr; 182 | } 183 | } 184 | 185 | address = dlsym( this->_handle, name.c_str() ); 186 | 187 | this->_symbols[ name ] = address; 188 | 189 | return address; 190 | } 191 | 192 | #endif 193 | } 194 | --------------------------------------------------------------------------------