Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

vladimir-lu/rust-static-cstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a small example of exporting a C string statically from a C-compatible shared library

The solution is based upon https://stackoverflow.com/questions/33850189/how-to-publish-a-constant-string-in-the-rust-ffi but I feel this is suboptimal.

Run ./build.sh to build.

Problems

  • Cannot use const fn because the feature is unstable
  • *const c_char does not implement Sync which is needed to have something static
  • &[u8].as_ptr() is not a const fn so cannot be used in a static struct initializer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published