Visual Studio Developer Center > Visual Studio Forums > Phoenix > Linking to a dll from a Plugin
Ask a questionAsk a question
 

QuestionLinking to a dll from a Plugin

  • Friday, November 06, 2009 3:32 PMYostal_Service Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I would like to build a plugin that inserts call instructions into the code it is creating that will call a dll, as in the BBCount example.  However, the BBCount example uses the PEModuleUnit's built in features to allow for the creation of an import symbol.  I've looked as well at the LoopInstrumentation example, but the example does not actually have to link up to a separate dll.

    I think  the key component I am missing is the ability to create an ImportModuleSymbol.  My clumsy attempts to do so are what cause my Phoenix exceptions currently, and if I could do that, the rest of the BBCount code seems to be compatible with what I am doing.

    Thanks in advance for any help you can provide.

All Replies

  • Monday, November 09, 2009 5:30 PMYostal_Service Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    For more detail on my difficulty, I'm trying to replace this code from the tool AddCall

    Phx::Symbols::ImportModuleSymbol ^ importmodulesym =
          module->FindImportModule(dllname);
    (AddCall project is in c++, obviously)

    with this code in my own project (which is in csharp):

    importmodulesym = (Phx.Symbols.ImportModuleSymbol) module.SymbolTable.Insert(
                        Phx.Symbols.ImportModuleSymbol.New(
                        module.SymbolTable, 0, dllname, false, null));

    I'm trying to create the import symbol for the dll, but so far, I am having no luck.  Again, any help would be greatly appreciated!