简体   繁体   中英

Using C# library in another directory from C++ application

I have a class, written in C#, shared between a C# and a C++ application.

To use it in the C++ app, I wrote a CLI wrapper class.

Simple diagram:

C++ App ---accesses---> CLI Library ---accesses---> C# library

Unfortunately, because of some name conflicts beyond my control, the C# and C+ applications need to be in separate directories.

What options are there for having my C++ app access these libraries in another directory?

Can I use AfxLoadLibrary in my C++ app to load the CLI library? In that case, would the CLI dll and the C# dll have to be in the same directory?

Can I have the managed CLI library load the C# library dynamically?

Are there any other options that I'm missing?

Another option:

Add a yourapp.exe.config file to your exe folder, listing one or more subfolders as probing paths . Put the files for each library assembly into one of the subfolders. You can put all assemblies (except the application assembly) into one folder if you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM