Visual Studio Development Bookmark and Share   
 index > Visual C++ Express Edition > GetFields
 

GetFields

hi all

System::Reflection::Assembly^ ttt = safe_cast<System::Reflection::Assembly^> (Row["Obj"]);

DBug (ttt->GetExportedTypes()[0]->GetMembers()[0]->Name->ToString()); // --> GET_PORT_S

DBug ("----");

System::Collections::IEnumerator^ myEnum = ttt->GetExportedTypes()[0]->GetFields()->GetEnumerator();

while ( myEnum->MoveNext() )

{

DBug (safe_cast<System::Reflection::FieldInfo^>(myEnum->Current)->ToString()); // --> Int32 TTT

}

external DLL

public ref class What

{

public:

What(void);

array<System:Surprisebject^, 2>^ GET_PORT_S(void);

int MemoryPhys(void);

int TTT;

};

//////

What::What ()

{

}

array<System:Surprisebject^, 2>^ What::GET_PORT_S()

{

int I_Need_this_One = 1; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< is there any way to read this one out including its value ???

}

thanks rick

new Newby  Sunday, June 17, 2007 9:51 AM
No, you can't use Reflection to access temporary variables that are stored on the stack frame. You would have to write a debugger and somehow get it to break the program just after the assignment.
nobugz  Monday, June 18, 2007 6:06 PM

thx

main purpose for this is i will have a bunch of smal dlls wich contains a few functions i need to have informations abouth them

in the moment i have in a known function a return whit the data i need

i think i will switch to having the function whit a bool argument returning the parameters

i think this COM thing is mainly for this ?

but seams a bit complicated to start whit it

or is it serialization ?

any sugestion ?

cheers rick

new Newby  Monday, June 18, 2007 9:41 PM
Nope, COM doesn't help. Serialization doesn't help. A return value doesn't help either, it is still stored in a CPU register or the stack frame. You are just plain old trying to do something that isn't supported. What you want to retrieve is something that lives for a microsecond or less.
nobugz  Monday, June 18, 2007 11:05 PM

i think you missunderstand me

i will have lot of dlls wich contains diferent functions of a few kind

lets say kind : input, output, activator ...

so if i call the function whit bool as argument and he tells me he is an input type i can call it next whit the proper arguments

this is the old solution

What::What ()
{
}
array<System:Surprisebject^, 2>^ What::GET_PORT_S()
{
array<System:Surprisebject^, 2>^ Ports = gcnew array<System:Surprisebject^,2>(1,6);
Ports[ 0, 0 ] = "MemoryPhys";
Ports[ 0, 1 ] = "Out";
Ports[ 0, 2 ] = nullptr;
Ports[ 0, 3 ] = int::typeid;
Ports[ 0, 4 ] = "byte";
Ports[ 0, 5 ] = "Installed Phisycal Memory";
return Ports;
}
int What::MemoryPhys()
{
MEMORYSTATUS stat;
GlobalMemoryStatus (&stat);
return 0;
}

so i think woud it by beter --> ( if it works need to try )

array<System:Surprisebject^, 2>^ What::MemoryPhys(bool)
{
//report what i am

}

i just have the feling that there is some automatization for this

new Newby  Tuesday, June 19, 2007 1:17 AM

You can use google to search for other answers

Custom Search

More Threads

• How to publish a project ?
• unresolved external symbol???
• identifier not found
• How i can use Structure in COM IDL file?
• Important Question. Regarding Linker Errors.
• #include <fstream.h>
• Managed Array of Unmanaged Memory
• Paint event problem
• Call Stack shows wrong parameters with (naked) functions
• How to add icons or other resources in VC++?