2012-05-28 4 views
0

В моем приложении C# мы используем библиотеку DLL, которая находится в VC++, мы хотим знать curent путь этой библиотеки в VC++,Как получить текущий путь к DLL

+0

Возможно, один из них поможет: (http://msdn.microsoft.com/en-us/library/windows/desktop/ms686944(v=vs.85).aspx) (http://msdn.microsoft .com/EN-US/библиотека/окна/настольные/ms684175 (v = vs.85) .aspx). –

ответ

2

Если вы пытаетесь получить место из C# можно использовать отражение и GetAssembly(Type type) method

В C++

Assembly^ SampleAssembly; 
// Instantiate a target object. Int32 Integer1(0); Type^ Type1; 
// Set the Type instance to the target class type. 
Type1 = Integer1.GetType(); 
// Instantiate an Assembly class to the assembly housing the Integer type. 
SampleAssembly = Assembly::GetAssembly(Integer1.GetType()); 
// Gets the location of the assembly using file: protocol. 
Console::WriteLine("CodeBase= {0}", SampleAssembly->CodeBase); 

или из вызывающего кода C# просто заменить ЦЕЛОЕ1 с типом из вашего VC++ сборки.

+0

Это действительно мило. –

Смежные вопросы