Hi :)
I'm developing a simple compiler for .Net, in C++, but am having problems with my include system, therefore not seem to find a way to recognize what kind of method I'm calling from dll if it is void , string, int...
so, my include system call the .net dll call
@include System
@include System:Windows:Forms
when will generate the code, need to know, what kind of method...
I wonder if anyone knows a way to get the type of methods, without using tools .net
One way I thought of using it: Create an application in C# or another .net language to generate a TXT, and this txt, contain the name of the methods and their proper type, and at compile time, I carry this txt and caught at compile time the type of method
But, I whant to know, if have an another way.
Thanks.
Alexandre
>----------------------------------------------
About this program that I talked is that:
using namespace System;
using namespace System::IO;
using namespace System::Reflection;
ref class Reflector
{
public:
void LoadAndReflect(String^ assemblyFileName)
{
Assembly^ assembly = Assembly::Load(assemblyFileName);
array<Type^>^ types = assembly->GetTypes();
StreamWriter^ sw = gcnew StreamWriter("mscorlib.txt");
for each(Type^ t in types)
{
array<MethodInfo^>^ methods = t->GetMethods();
for each(MethodInfo^ method in methods)
{
String^ base = method->ReturnType->ToString();
array<String^>^ auxBase = base->Split('.');
if(auxBase->Length > 1)
sw->WriteLine(String::Format("{0} <::> {1}", auxBase[1], method->Name));
else
sw->WriteLine(String::Format("{0} <::> {1}", auxBase[0], method->Name));
}
}
sw->Close();
}
};
int main(array<System::String ^> ^args)
{
Reflector^ ref = gcnew Reflector();
Console::WriteLine("Reflection on {0}", "mscorlib.dll");
ref->LoadAndReflect("mscorlib.dll");
return 0;
}
And, in compiler time, I open that txt and I get the method type
....
>---------------------------------- Edit 12:14 ( BRT )
I know ( now ) about the IMetaDataAssemblyImport, but, I don't know, how to get the informations usint that class :(