Groups | Blog | Home
all groups > dotnet interop > august 2005 >

dotnet interop : Loading Legacy DLL In Dot Net (DLL Name Differs)


garyivy NO[at]SPAM gmail.com
8/5/2005 1:52:31 PM
Hello,

I need to load a DLL I wrote in C++ into a VB.Net app that differs in
name.

I can load the dll just fine using a Declare Function using a hardcoded
name. However, for production, the DLL name varies based other
factors(same signature, different names).

I am seen Microsoft's example of changing the path dynamically. But, I
have not seen an example of changing the entire DLL name.

I don't think it is possible. But, before I code around this issue, I
was hoping someone had a solved this issue.

Thanks.

Gary Ivy
Extreme Datasets
8/6/2005 3:18:01 PM
Is there any reason you need to use P/Invoke vs the RCW? If that is not
acceptable, add an App.Config file and store the name of the DLL in the
config file and read it from there before you load. This should work fine for
ya.

If that doesn't work for some reason, let me know and I am sure we can
figure something out.


[quoted text, click to view]
Gary Ivy
8/6/2005 9:13:49 PM
I am not familiar with the RCW acronym.

I am rewriting a windows service that parses text files as they are
ftp'd in. The service defers to about 12 different dlls based on the
text file name and an ini file entry. Long term, I am going to port
the logic in these DLLs to dot net assemblies and load them as
plug-ins. But, it is risky to do them all at once.

This app.config approach could work if I can use different config files
or different entries in a config file based on the file context.

Thanks for the reply. Any more thoughts? Or perhaps an example?

Thanks.

Gary Ivy
Extreme Datasets
8/6/2005 9:29:02 PM
RCW, the runtime callable wrapper. Add a COM reference to the application and
a wrapper will be created for you.

Example of what?

[quoted text, click to view]
Gary Ivy
8/7/2005 3:59:49 PM
The dlls I am loading are not COM dlls. They use extern WINAPI
functions.

Thanks.
AddThis Social Bookmark Button