McNeel Wiki
Info: Plug-in Loading
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

 
.
DeveloperC++, .NET
VersionRhino 4

C++ Overview

Rhino loads plug-ins, which are regular MFC DLLs, using the LoadLibraryEx() Win32 SDK function. All plug-in types are loaded in the same manner.

Rhino plug-ins are loaded twice. The first time as follows:

  hModule = ::LoadLibraryEx( 
          lpFileName, 
          0, 
          DONT_RESOLVE_DLL_REFERENCES | LOAD_WITH_ALTERED_SEARCH_PATH 
          );

Note that the plug-in is loaded without dependencies. This allows Rhino to quickly verify the Rhino SDK version and that the proper plug-in exports are available. Also, the altered search path flag is used so LoadLibraryEx() looks for dependent DLLs in the directory specified by lpFileName, not by Rhino4.exe.

The plug-in module is freed as follows:

  ::FreeLibrary( hModule );

If the above was successful, the plug-in is loaded for a final time as follows:

 hModule = ::LoadLibraryEx( 
          lpFileName, 
          0, 
          LOAD_WITH_ALTERED_SEARCH_PATH 
          );

Again, the altered search path flag is used.

.NET Overview

Rhino loads .NET plug-ins, which are regular .NET assemblies, using the Reflection classes in .NET

Rhino plug-ins are loaded twice. The first time using ReflectionOnlyLoadFrom to determine the version of Rhino_DotNet the plug-in was compiled against. If the version is more recent than what is installed on the user's computer, Rhino will notify the user that a more recent build of Rhino is required to run the plug-in.

The second time Rhino uses Reflection::Assembly::LoadFrom to load the plug-in. Once the plug-in is loaded, Rhino iterates through all of the public classes and creates instances of every command and plugin subclass.

rename · changes · history · subscriptions · lost and found · references · file upload