What is the best way to wrap our library of software to serve both C ++ and C # client applications?

I am starting work on a new project where the main product is the Software Library . There is existing code that we will wrap written in C ++ because it is very numerically intense; we own and compile this core code.

I believe that we will have two well-known types of clients: 1. An application written in C ++, possibly MFC 2. An application written in C # .NET.

Question . To offer the “perfect” interface for both types of customers, what technology do we use? For example, we could offer two interfaces: one using C / C ++ functions and callbacks for C ++ clients, and the other using C # .NET for C # clients? In addition, in principle, is it possible to do this beautifully in one DLL, or do we want two (or more)?

Other information . Client applications are built-in, not on the desktop or laptop; Suppose any user interface is not Windows. We will also have to compile and test for both 32-bit and 64-bit, possibly C ++ for 32-bit and C # on 64-bit.

My apologies here. I understand that this question may have been asked and answered earlier, but if so, I could not find it.

+3
source share
1 answer

An interesting question, I look forward to other answers.

One possible solution may not be the best: if your library code follows object-oriented practices, you can write basic functionality in C ++, and then provide separate COM shell classes around the main classes (also in C ++). This will allow you to use library components from .NET through COM interoperability. I do not know how effective this is. I suspect that performance should usually be excellent, and COM has some obvious flaws (e.g. no generics), so this may not be the optimal solution.

-, , DLL .NET, P/Invoke..., , , # ++ DLL.

+5

Source: https://habr.com/ru/post/1771365/


All Articles