我有一个Linux C ++ SDK,我需要将其作为依赖项集成到.NET 6.0较大的项目中。
该SDK仅在软件的Linux版本中 ,我确实已经运行了Windows版本,没有问题。
此SKD仅在非常嵌套的名称空间中公开类,据我所知, [dllimport]
不支持类方法。
我确实已经知道如何创建包装器和用 extern“ c”
公开函数,并将SDK实例传递给指针到Linux Systems在Linux Systems毫无问题的.NET核心应用程序中,
我的问题是我确实做到了不知道如何成功地编译/include/link现有 .so
文件到.dll或..这样我就可以 [dllimport]
SDK已发送了对我来说,具有以下结构(以lib的名称为占位符名称。我不确定我是否可以公开真实的公司名称,以防万一,以防万一):
run/
|- x86/
| +- {same files as x64 but i don't target x86 arcs so it's useless}
+- x64/
|- install.sh {see #1}
|- libNameModuleA.so.1.2.3
|- libNameModuleB.so.3.2.1
|- libNameApi.so.7.8.9
+- {etc. etc.}
lib/
|- lib-name-api/
| |- doc/
| | +- somehtmlautogenerateddocs.html
| |- include/
| | +- NameApi.h
| +- source/ {optionally for the top level apis}
| +- {varius header .h files}
|- name-of-lib-module-A/
| +- {same as previus, repeat for every .so file}
+- {etc. etc.}
{#1}脚本craetes链接为libname.so => libname.so.1 => libname.so.1.2 =>等
所有这些库标头文件都像在同一文件夹中一样互相引用,使用 #include“ sublibrarymodule.h”
,即使此文件实际上将在 ../ ../ sublibrary/include/sublibrarymodule.h
。
另外,在SKD中只有标题。
现在,是什么(我真的不知道Waht是最好的工具)CMake,Make,G ++,GCC命令,配置或过程,可以包括引用所有其他所有内容的顶级标头编译中未找到编译器中的错误?
假设我需要编译一个文件 wrapper.cpp
,该文件仅包含顶级标头,仅包含 extern“ c”
函数,
我尝试使用vscode和intelliSense进行此操作。实际上可以正确解析标头,但是当我尝试编译时,一切都爆发为未创建的文件,
我错过了一些东西吗?我错过了更多信息或文件吗?
提前致谢。
I have a linux c++ sdk that i need to integrate as a dependency into a .NET 6.0 bigger project.
This sdk is only conditionally included for the linux version of the software, i do already have the windows version running with no problems.
This skd exposes only classes in very nested namespaces, and as far as i'm aware, [DllImport]
does not support class methods.
I do already know how to create a wrapper and expose functions with extern "C"
and passing the sdk instances as pointers to a .NET Core application running with no problem under linux systems
My problem is that i do have no idea on how to succesfully compile/include/link the existing .so
files into a .dll or .so that i can then [DllImport]
The sdk has been sent to me with the following structure (take name-of-lib as the placeholder name. I'm not sure if i can expose the real company name so i won't just in case):
run/
|- x86/
| +- {same files as x64 but i don't target x86 arcs so it's useless}
+- x64/
|- install.sh {see #1}
|- libNameModuleA.so.1.2.3
|- libNameModuleB.so.3.2.1
|- libNameApi.so.7.8.9
+- {etc. etc.}
lib/
|- lib-name-api/
| |- doc/
| | +- somehtmlautogenerateddocs.html
| |- include/
| | +- NameApi.h
| +- source/ {optionally for the top level apis}
| +- {varius header .h files}
|- name-of-lib-module-A/
| +- {same as previus, repeat for every .so file}
+- {etc. etc.}
{#1} script that craetes links as libName.so => libName.so.1 => libName.so.1.2 => etc
All of those library header files reference each other like they were in the same folder, using an #include "subLibraryModule.h"
even if this file would actually be in something like ../../subLibrary/include/subLibraryModule.h
.
Also, in the skd there are only headers.
now, what would be the (either, i don't really know waht would be the best tool) cmake, make, g++, gcc command, configuration or procedure to be able to include the top-level header that references all of the other ones in the compilation without a file not found
error from the compiler?
Say i need to compile a single file wrapper.cpp
that includes only the top level headers and contains only extern "C"
functions
I've tried doing this with vscode and intellisense actually resolves the headers correctly, but when i try to compile it everything bursts into a fire of file-not-founds
Am I missing something? Is there further information or files i missed?
Thanks in advance.
发布评论
评论(1)
所以我发现了。
MAKEFILE
这里唯一的问题是我不知道如何使用Glob模式自动包含内容(例如
-ilib/*/include
),但无论如何。wrapper.cpp
下复制
casv casvius over.so需要在可执行文件为csharpclass.cs
。
(注意:该过程非常有效。但是我一直在使用痉挛性猴子编写和记录的库。是的,我从字面上学到了G ++的基础知识,使抑郁症无所适从。
So i figured it out.
makefile
The only problem here is that i did not know how to use a glob pattern to include stuff automatically (like
-Ilib/*/include
) but whatever.wrapper.cpp
obviusly the .so needs to be copied where the executable is
csharpClass.cs
resources:
(note: the process works perfectly. But i've been using a library written and documented by a spastic monkey. So yeah i've literally learned the basics of g++, make and got crippling depression for nothing. lol)