EDIT: I want to implement C++ (with no limits, using intrinsics, inlines, optimizing), choose in the implementation what is visible on .NET (C# at least) and indeed use it, compiling from invisible only what is needed to visible resorces working.
Can we declare and use structures and classes in C# but implement them in C++ (or C++/Cli)?
Something like that with the reality adjustment, correct projets, settings...
First file. EDIT: Setting what is visible.
// Random.cs
// Declarations
[StructLayout( Size=8 )] struct Random {
public Random() ;
public Random( long Seed ) ;
public Random( ulong Seed ) ;
public uint randomize { get ; }
public static uint Randomize { get ; }
public int randomize( int Minimal , int Maximal ) ;
public uint randomize( uint Minimal , uint Maximal ) ;
public static int Randomize( int Minimal , int Maximal ) ;
public static uint Randomize( uint Minimal , uint Maximal ) ;
}
Second file. EDIT: Setting what exists (visible, required invisible and unrequired).
// Random.cpp
// Definitions
// +Intrinsics
// +Inlines
# include <intrin.h>
# include <memory.h>
__forceinline unsigned __int64 __generate( void *source ){
// Implementation
}
__forceinline unsigned __int32 __randomize( void *source ){
// Implementation
}
template< typename type > __forceinline type __randomize( void *source , type minimal , type maximal ){
// Implementation
}
Random __global ;
Random::Random(){
unsigned __int64 seed = __rdtsc() ;
memmove( this , &seed , 8 ) ;
}
Random::Random( __int64 seed ){
memmove( this , &seed , 8 ) ;
}
Random::Random( unsigned __int64 seed ){
memmove( this , &seed , 8 ) ;
}
unsigned __int32 Random::randomize::get {
return __randomize( this ) ;
}
unsigned __int32 Random::Randomize::get {
return __randomize( &__global ) ;
}
__int32 Random::randomize( __int32 minimal , __int32 maximal ){
return __randomize( this , minimal , maximal ) ;
}
__int32 Random::Randomize( __int32 minimal , __int32 maximal ){
return __randomize( &__global , minimal , maximal ) ;
}
unsigned __int32 Random::randomize( unsigned __int32 minimal , unsigned __int32 maximal ){
return __randomize( this , minimal , maximal ) ;
}
unsigned __int32 Random::Randomize( unsigned __int32 minimal , unsigned __int32 maximal ){
return __randomize( &__global , minimal , maximal ) ;
}
Third file. EDIT: using only visible resources, compiling only used visible (in case only one class method) and needed codes to visible code works. If dll, compiles all visible and all needed codes to it.
// VCsTester.cs
// Application
using System ;
class VCsTester {
static void Main( string[] args ) {
do {
Console.Write( "\b \b\b \b\b \b\b \b\b \b\b\b \b\b \b\b\b \b\b \b\b \b\b\b \b\b \b\b \b\b \b\b \b\b\b \b\b \b\b \b\b \b\b \b\b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b\b \b\b \b\b\b \b\b \b\b \b\b \b\b \b\b\b \b\b \b\b \b\b \b\b \b" ) ;
Console.WriteLine( " Random Value = " + Random.randomize ) ;
Console.Write( "Press space to repeat. Press other key to quit." ) ;
} while( Console.ReadKey( true ).KeyChar == ' ' ) ;
}
}
Must we use C++/CLI? P/Invoke? Can't do with no dll?
What's the step-by-step? I find nothing so palpable.