Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.32 KB | None | 0 0
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using binderoo;
  4. //----------------------------------------------------------------------------
  5.  
  6. namespace somemodule
  7. {
  8.     public static class rubbish
  9.     {
  10.         // Function somemodule.rubbish.generateSomeRubbish
  11.         private static ImportedFunction func_generateSomeRubbish;
  12.         private delegate float DelegategenerateSomeRubbish( );
  13.         public static float generateSomeRubbish( )
  14.         {
  15.             if( func_generateSomeRubbish == null ) func_generateSomeRubbish = new ImportedFunction( "somemodule.rubbish.generateSomeRubbish", "float()" );
  16.             DelegategenerateSomeRubbish call = (DelegategenerateSomeRubbish)Marshal.GetDelegateForFunctionPointer( func_generateSomeRubbish.FuncPtr, typeof( DelegategenerateSomeRubbish ) );
  17.             return call( );
  18.         }
  19.         //--------------------------------------------------------------------
  20.  
  21.         // Function somemodule.rubbish.justPrintSomething
  22.         private static ImportedFunction func_justPrintSomething;
  23.         private delegate void DelegatejustPrintSomething( );
  24.         public static void justPrintSomething( )
  25.         {
  26.             if( func_justPrintSomething == null ) func_justPrintSomething = new ImportedFunction( "somemodule.rubbish.justPrintSomething", "void()" );
  27.             DelegatejustPrintSomething call = (DelegatejustPrintSomething)Marshal.GetDelegateForFunctionPointer( func_justPrintSomething.FuncPtr, typeof( DelegatejustPrintSomething ) );
  28.             call(  );
  29.         }
  30.         //--------------------------------------------------------------------
  31.  
  32.     }
  33.     //------------------------------------------------------------------------
  34.  
  35. }
  36. //----------------------------------------------------------------------------
  37.  
  38. public static class anothertestobject
  39. {
  40.     // Function anothertestobject.doAThing
  41.     private static ImportedFunction func_doAThing;
  42.     private delegate void DelegatedoAThing( int foo, float bar );
  43.     public static void doAThing( int foo, float bar )
  44.     {
  45.         if( func_doAThing == null ) func_doAThing = new ImportedFunction( "anothertestobject.doAThing", "void(int32_t, float)" );
  46.         DelegatedoAThing call = (DelegatedoAThing)Marshal.GetDelegateForFunctionPointer( func_doAThing.FuncPtr, typeof( DelegatedoAThing ) );
  47.         call( foo, bar );
  48.     }
  49.     //------------------------------------------------------------------------
  50.  
  51. }
  52. //----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement