C++ Module Dynamic Library
This is a console application that has a single dynamic library dependency.
library/recipe.sml
The Recipe file that defines the static library "Samples.Cpp.ModuleDynamicLibrary.Library".
Name: 'Samples.Cpp.ModuleDynamicLibrary.Library'
Language: 'C++|0'
Version: 1.0.0
Type: 'DynamicLibrary'
library/mibrary.cpp
A module interface file that exports a single sample class.
module;
// Include all standard library headers in the global module
#include <string>
export module Samples.Cpp.ModuleDynamicLibrary.Library;
// Note: The namespace does not have to match the module name
export namespace Samples::Cpp::DynamicLibrary::Library
{
class Helper
{
public:
#ifdef _WIN32
__declspec(dllexport)
#endif
static std::string GetName()
{
return "Soup";
}
};
}
application/recipe.sml
The Recipe file that defines the executable "Samples.Cpp.ModuleDynamicLibrary.Application".
Name: 'Samples.Cpp.ModuleDynamicLibrary.Application'
Language: 'C++|0'
Type: 'Executable'
Version: 1.0.0
Dependencies: {
Runtime: [
'../library/'
]
}
application/package-lock.sml
The package lock that was generated to capture the unique dependencies required to build this project and the dynamic library dependency.
application/main.cpp
A simple main method that prints our "Hello World, Soup Style!" by using the module from the library.
#include <iostream>
import Samples.Cpp.ModuleDynamicLibrary.Library;
using namespace Samples::Cpp::DynamicLibrary::Library;
int main()
{
std::cout << "Hello World, " << Helper::GetName() << " Style!" << std::endl;
return 0;
}
.gitignore
A simple git ignore file to exclude all Soup build output.