Added a macro for wrapping C STD lib functions.
This commit is contained in:
		@ -1,3 +1,37 @@
 | 
			
		||||
#[macro_export]
 | 
			
		||||
macro_rules! c_library
 | 
			
		||||
{
 | 
			
		||||
   {
 | 
			
		||||
      $(statics:
 | 
			
		||||
        {
 | 
			
		||||
           $($sname: ident: $stype: ty);+;
 | 
			
		||||
        }
 | 
			
		||||
      )?
 | 
			
		||||
 | 
			
		||||
      $(functions:
 | 
			
		||||
        {
 | 
			
		||||
           $($fname: ident($($farg: ident: $fargt: ty),*) -> $fret:ty);+;
 | 
			
		||||
        }
 | 
			
		||||
      )?
 | 
			
		||||
 | 
			
		||||
      $(varargs:
 | 
			
		||||
        {
 | 
			
		||||
           $($vname: ident($($vargs: ident: $vargst: ty),+) -> $vret:ty);+;
 | 
			
		||||
        }
 | 
			
		||||
      )?
 | 
			
		||||
   } =>
 | 
			
		||||
   {
 | 
			
		||||
      extern "C"
 | 
			
		||||
      {
 | 
			
		||||
         $($(pub static $sname: $stype;)+)?
 | 
			
		||||
 | 
			
		||||
         $($(pub fn $fname($($farg: $fargt),*) -> $fret;)+)?
 | 
			
		||||
 | 
			
		||||
         $($(pub fn $vname($(vargs: $vargst),+ , ...) -> $vret;)+)?
 | 
			
		||||
      }
 | 
			
		||||
   };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[macro_export]
 | 
			
		||||
macro_rules! external_library
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user