Is it possible to call functions in one executable from another?
I have two executables - one 开发者_如何学运维GUI, one command line. I want to be able to call functions in one from the other. Ordinarily I would refactor out the common code to a static library so it's accessible from both, but I can't do that in this instance (due to problems with some of VS2008's code auto-generation for database bindings).
I assume that this must be possible in some way as the unit test applications use this mechanism. How do you do this in general?
Simple -- add a reference to the assembly you want to call into from the other. If both assemblies are built in the same solution, just use a project reference. Obviously you can't call both assemblies from the other, since this would create a circular reference.
精彩评论