Microsoft Developer Network > Página Inicial dos Fóruns > Phoenix > Get type of function parameter
Fazer uma PerguntaFazer uma Pergunta
 

RespondidoGet type of function parameter

  • terça-feira, 26 de maio de 2009 8:48shootingsyh Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    I have an assembly A, which contains some functions:
    void log(Uri u);
    void log(int i);
    void log(CustomType t);

    The CustomType is defined in another assembly B.

    I open the assembly A use PEModuleUnit.Open, then I want to get the parameter types for each log function and add them into a array.

    But I found that the ParameterSymbol.Type doesn't give the expected type.

    I expect the parameter of type uri has the type object32->class64, and the class64 should have symbol of name "System.Uri". But the result is the class64 is a function ClrCall.Function(i32)->(object32->class64) type!!

    Can anyone tell me what happens to the type "Uri"? Thanks

    The same thing happens to the CustomType, just the object32->class64 type, and the class64 type is a ClrCall.Function()->(void)

Respostas

  • terça-feira, 26 de maio de 2009 15:34Andy Ayers - MSFTModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Depending on how you have set the cross-assembly type resolution, you may need to use type.IsReferenceTo(type). By default I believe we preserve the distinction between references and definitions.
    Architect - Microsoft Phoenix Project
    • Marcado como Respostashootingsyh quinta-feira, 10 de setembro de 2009 2:54
    •  

Todas as Respostas

  • terça-feira, 26 de maio de 2009 8:52shootingsyh Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    The above process happends in some process Phase of assembly B. There are a function called Perform(Uri u, CustomType c) in B. After the above process, I load the function unit of Perform and retrieve it's parameter types. Then I found the type of u in B.Perform is not equal to type of u in A.log. But they are all of type Uri, why the .Equal and all other .IsEqualxxx return false?
  • terça-feira, 26 de maio de 2009 15:31Andy Ayers - MSFTModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    How are you getting the name of the class64 type? It almost looks like you are getting its constructor member's type instead. The name of a type is found on the type symbol for the type.
    Architect - Microsoft Phoenix Project
  • terça-feira, 26 de maio de 2009 15:34Andy Ayers - MSFTModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Depending on how you have set the cross-assembly type resolution, you may need to use type.IsReferenceTo(type). By default I believe we preserve the distinction between references and definitions.
    Architect - Microsoft Phoenix Project
    • Marcado como Respostashootingsyh quinta-feira, 10 de setembro de 2009 2:54
    •  
  • terça-feira, 16 de junho de 2009 6:28shootingsyh Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     

    I still cannot get the right type of the parameter. I found the type symbol of that type is just null. I’ve tried to get the type both from the ParameterSymbols and destination operand of function enter instruction, but failed on both of them. Is there some approach I should perform to load the symbol? Since it’s just a Uri class, the symbol should be there.