简体   繁体   English

从库创建DLL,无需任何新代码

[英]Creating a DLL from libs without any new code

I have a dll that uses managed c++ and consumes a native c++ library. 我有一个使用托管c ++并使用本机c ++库的dll。 This dll is then in turn consumed by ac# interface. 然后,此dll被ac#接口消耗。 As you probably guessed, the managed c++ is just interop code. 您可能已经猜到了,托管c ++只是互操作代码。 Nothing in this is exported. 此内容未导出。

We have a new requirement that both the managed c++ and native c++ be accessed by an external c++ executable (for internal testing purposes). 我们有一个新的要求,即外部c ++可执行文件(用于内部测试)都必须访问托管c ++和本机c ++。 So I was thinking of changing the managed c++ layer to a lib, and have a separate project that creates the dll by consuming the managed and the native libs. 因此,我正在考虑将托管c ++层更改为lib,并拥有一个单独的项目,该项目通过使用托管库和本机库来创建dll。 There wouldn't be any new code in there. 那里没有任何新代码。 It's just a project that consumes the two libs. 这只是一个占用两个库的项目。 Then, we could have another project that also consumes these two libs and adds on top a bit of test code. 然后,我们可以有另一个项目,该项目也使用这两个库并在顶部添加一些测试代码。 But I'm having a great deal of difficulty in getting this to work. 但是,要使其正常工作,我遇到了很多困难。 I cannot get the IDE to generate my dll. 我无法使IDE生成我的dll。 Does anyone have any suggestions for me? 有人对我有什么建议吗?

You cannot create a static link library from managed code, there's no support for it in the VS build system. 您不能从托管代码创建静态链接库,VS构建系统不支持它。 The unit of storage for managed code is an assembly. 托管代码的存储单位是程序集。 They are not linked at build time, it happens at runtime. 它们在构建时未链接,而是在运行时发生。 Beware that your test program needs to be managed in order to test your wrapper. 请注意,为了管理包装程序,需要管理您的测试程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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