summaryrefslogtreecommitdiffstats
path: root/slang.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-12-10 14:04:29 -0500
committerGitHub <noreply@github.com>2020-12-10 14:04:29 -0500
commit4337338ed2d9525b4638f32c6b91ef61b69e41cd (patch)
treebade08ed9e1b835a73fe97b5ecb331ae940fee86 /slang.h
parente4a8251749cf1fbf005b045e26e25f3ef7cccb8b (diff)
Building with embedded stdlib (#1634)
* #include an absolute path didn't work - because paths were taken to always be relative. * Move reflection to reflection-api. * Slight reorg to pull out potentially Slang internal functions from the reflection API impls. * Remove visual studio projects * Fix for slang-binaries copy. * Add the visual studio projects in build/visual-studio * Remove miniz project. * Differentiate the linePath from the filePath. * Improve comment in premake5.lua + to kick of CI. * Kick CI. * Use COM compile request for calls to functions inside api-less-slang. Add static-slang project. * Fix const typo issue. * Don't include 'core' link in 'api-less-slang' * Removed static-slang lib causes problems on linux with linking. Embed Slang stdlib Added StaticBlob Added dumpSourceBytes Use ConstArrayView for the archive. At startup allow loading of zip with stdlib. Made -save-stdlib -load-stdlib take a name Added '-save-stdlib-bin-source' to save out serialized stdlib as source. * Ability enable/disable stdlib embedding. * Fix problem with moduleDecl not having module pointer set when serialized in. * Set of debugdir for slang-test and examples. * Add slang-stdlib-api.cpp * Update slang filters for VS. * Try to use pic, and -mcmodel=medium * Some more efforts ot make premake work. * WIP premake5.lua from previously working version. * Remove api-less-slang project. * Disable dllexport on gcc/clang. * Embed via slangc-bootstrap. * Fix slang-profile. Always compiles without stdlib. * Use pic "On" * Remove slangc-bootstrap and embed-stdlib-generator if embedding not required. Make bootstrap run the generators. * Improve comments in premake5.lua. Kick off another CI build. * Remove generation of stdlib source from std-lib-serialize.slang
Diffstat (limited to 'slang.h')
-rw-r--r--slang.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/slang.h b/slang.h
index f09f15c24..87144df86 100644
--- a/slang.h
+++ b/slang.h
@@ -195,7 +195,13 @@ convention for interface methods.
#if defined(_MSC_VER)
# define SLANG_DLL_EXPORT __declspec(dllexport)
#else
-# define SLANG_DLL_EXPORT __attribute__((__visibility__("default")))
+# if 0 && __GNUC__ >= 4
+// Didn't work on latest gcc on linux.. so disable for now
+// https://gcc.gnu.org/wiki/Visibility
+# define SLANG_DLL_EXPORT __attribute__ ((dllexport))
+# else
+# define SLANG_DLL_EXPORT __attribute__((__visibility__("default")))
+# endif
#endif
#if defined(SLANG_DYNAMIC)
@@ -3092,14 +3098,19 @@ namespace slang
*/
virtual SLANG_NO_THROW SlangResult SLANG_MCALL compileStdLib() = 0;
- /** Load the StdLib. Currently loads modules from the file system
- NOTE! API is experimental and not ready for production code
+ /** Load the StdLib. Currently loads modules from the file system.
+ @param stdLib Start address of the serialized stdlib
+ @param stdLibSizeInBytes The size in bytes of the serialized stdlib
+
+ NOTE! API is experimental and not ready for production code
*/
- virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadStdLib() = 0;
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL loadStdLib(const void* stdLib, size_t stdLibSizeInBytes) = 0;
/** Save the StdLib modules to the file system
+ @param outBlob The serialized blob containing the standard library
+
NOTE! API is experimental and not ready for production code */
- virtual SLANG_NO_THROW SlangResult SLANG_MCALL saveStdLib() = 0;
+ virtual SLANG_NO_THROW SlangResult SLANG_MCALL saveStdLib(ISlangBlob** outBlob) = 0;
};
#define SLANG_UUID_IGlobalSession { 0xc140b5fd, 0xc78, 0x452e, { 0xba, 0x7c, 0x1a, 0x1e, 0x70, 0xc7, 0xf7, 0x1c } };
@@ -4050,6 +4061,11 @@ SLANG_EXTERN_C SLANG_API SlangResult slang_createGlobalSessionWithoutStdLib(
SlangInt apiVersion,
slang::IGlobalSession** outGlobalSession);
+/* Returns a blob that contains the serialized stdlib.
+Returns nullptr if there isn't an embedded stdlib.
+*/
+SLANG_API ISlangBlob* slang_getEmbeddedStdLib();
+
namespace slang
{
inline SlangResult createGlobalSession(