/* Plugins are components, so they need a Construct() function. This is where you add the entry points and extensions */ void _LocalPlugin_Construct( void* component, Stg_ComponentFactory* cf, void* data ) { MockContext* context = (MockContext*)Stg_ComponentFactory_ConstructByName(cf, "context", Stg_Component, True, data ); EP_Append( context->ep, LocalPlugin_Function ); }
int main( int argc, char* argv[] ) { MPI_Comm CommWorld; int rank; int numProcessors; int procToWatch; EntryPoint* entryPoint; Stream* stream; double result; /* Initialise MPI, get world info */ MPI_Init( &argc, &argv ); MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld ); MPI_Comm_size( CommWorld, &numProcessors ); MPI_Comm_rank( CommWorld, &rank ); BaseFoundation_Init( &argc, &argv ); BaseIO_Init( &argc, &argv ); BaseContainer_Init( &argc, &argv ); BaseAutomation_Init( &argc, &argv ); BaseExtensibility_Init( &argc, &argv ); if( argc >= 2 ) { procToWatch = atoi( argv[1] ); } else { procToWatch = 0; } /* creating a stream */ stream = Journal_Register( InfoStream_Type, "myStream" ); Stream_SetPrintingRank( stream, procToWatch ); Journal_Printf( stream, "Watching rank: %i\n", rank ); /* Get Maximum of Values */ entryPoint = EntryPoint_New( testEpName, EntryPoint_Maximum_VoidPtr_CastType ); EP_Append( entryPoint, Return1 ); EP_Append( entryPoint, Return89 ); EP_Append( entryPoint, ReturnNeg43 ); EP_Append( entryPoint, ReturnZero ); result = ((EntryPoint_Maximum_VoidPtr_CallCast*) entryPoint->run)( entryPoint, stream ); Journal_PrintDouble( stream, result ); Stg_Class_Delete( entryPoint ); /* Get Minimum of Values */ entryPoint = EntryPoint_New( testEpName, EntryPoint_Minimum_VoidPtr_CastType ); EP_Append( entryPoint, Return1 ); EP_Append( entryPoint, Return89 ); EP_Append( entryPoint, ReturnNeg43 ); EP_Append( entryPoint, ReturnZero ); result = ((EntryPoint_Minimum_VoidPtr_CallCast*) entryPoint->run)( entryPoint, stream ); Journal_PrintDouble( stream, result ); Stg_Class_Delete( entryPoint ); BaseExtensibility_Finalise(); BaseAutomation_Finalise(); BaseContainer_Finalise(); BaseIO_Finalise(); BaseFoundation_Finalise(); /* Close off MPI */ MPI_Finalize(); return 0; /* success */ }
void RemotePlugin1_Register( void* entryPoint ) { EP_Append( entryPoint, RemotePlugin1_Function ); }