I called the Managed Dll successfully when the Managed Dlls and the
Unmanaged Dlls have not the same filename;
The method was introduced on
http://www.codeproject.com/dotnet/br...call%7Cmanaged.
The Dlls have the same filename in separate folders.It's impossible to
change the filename whether Managed Dll or
UnManaged Dll.
When run the program(unmanaged),firstly,load the unmanaged file
'Pubfunction.dll' by LoadLibrary;And when call the
function implement in managed Dll,I used a Bridge to call managed Dll.The
managed Project static reference the managed Dll named Pubfuncion.It will be
failed to load managed file Pubfunction.dll.The system first scan the
filelist which have been
Loaded.
"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> дÈëÓÊ
¼þ news:OQwGpNnsDHA.2132@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi,
>
> Firstly, you cannot have two files having the same name (probably only[/color]
with[color=blue]
> differences in character case) in the same folder (may be NTFS allows this
> but FAT32 definitely not). Therefore, you will have to store these DLLs in
> separate folders.
>
> Secondly, while managed DLLs CAN be loaded with LoadLibrary, there is[/color]
little[color=blue]
> sense in doing so. The simplest way to expose a managed library to[/color]
unmanaged[color=blue]
> code is by making the managed library COM-visible.
> Hence, the .NET Interop subsystem will take care of the DLL location -[/color]
your[color=blue]
> only responsibility would be to register the managed DLL with the
> appropriate tool (regasm.exe). Provided it is stored in a separate folder,
> this will ensure the framework will be able to successfully locate and[/color]
load[color=blue]
> the managed DLL.
>
> Does this answer your question?
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
>
http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> "kinghuangz" <lin-huang@vip.sina.com> wrote in message
> news:%23yRQEllsDHA.2004@TK2MSFTNGP10.phx.gbl...[color=green]
> > Everyone:
> > I want to use a DLL(FileName:PubFunction.Dll) built with VS.Net(C#)[/color][/color]
in[color=blue]
> a[color=green]
> > unmanaged Program .But there was a Dll just has the same filename,it was
> > built with VC++(6.0).The unmanaged was loaded by LoadLibrary function
> > firstly,and it would be free until the Program's end.How can I Load the
> > managed Dll?
> >
> >[/color]
>[/color]