Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# bindings for .net 8.0 #442

Open
VE3NEA opened this issue Nov 11, 2024 · 6 comments
Open

C# bindings for .net 8.0 #442

VE3NEA opened this issue Nov 11, 2024 · 6 comments

Comments

@VE3NEA
Copy link

VE3NEA commented Nov 11, 2024

I have created a Visual Studio solution to build the SoapySDR C# bindings for .net 8.0, and generated html documentation for the bindings. The solution also includes a utility in C# that enumerates the SDR devices and collects all available info about them. The repository is here.

Please see if you can include this work in the SoapySDR project. I cannot do that because I do not have enough experience with cmake.

@zuckschwerdt
Copy link
Member

Interesting, thanks. The SoapySDR project would need to include control files (for swig it's .i files) and (CMake) rules, not generated files and binaries.

Can you detail which files are original (as opposed to unmodified generated files) and what process you used to generate files (swig options etc.)? What about the doc files, are those generated (by docfx) based on just the .cs files? With the C# files I'm not sure how all those are generated and if they are unmodified?

For the binary files there should be an indication where those came from, which version and how to update. (Or preferably a way to download unpack and copy over when needed as those usually would not be include with source files).

It's nice to see this all bundled for a working example. Maybe this is more of a complete starter kit than an enhancement to SoapySDR?

@VE3NEA
Copy link
Author

VE3NEA commented Nov 11, 2024

There are two projects in the repo, Pothosware.SoapySDR and ListSoapySdrDevices. For the first project I just cloned SoapySDR and ran cmake, then I created a new .net 8.0 Class Library project and added the existing c# files to it. The only new file in this project is Pothosware.SoapySDR.csproj.

The documentation is generated by running DocFX in the doc folder, without arguments.. The doc generation settings are in the docfx.json file. It is currently configured to produce html for offline reading, but it could be changed to generate files for publishing on Github Pages.

The source code in the second project is mine. It makes use of the Pothosware.SoapySDR.dll library built in the first project, all other dll's were built by cloning the corresponding repositories and running cmake + VS on them. The plugin projects had to be modified to get the include and library files from the SoapySDR repository instead of those that come with the Pothosware deployment.

I can keep my repository for those who need the whole thing, but some parts of it, such as the .net 8.0 project and docs, could be added to the SoapySDR project.

@VE3NEA VE3NEA changed the title C# bindings for .net 8.8 C# bindings for .net 8.0 Nov 11, 2024
@zuckschwerdt
Copy link
Member

Usually projects don't include files that can be readily generated. I think the most benefit for other developers trying to get started would be to have an expanded step-by-step howto, like you wrote above, along an example repo like you created.

Like e.g.

  • download or clone the repo from url
  • run cmake ..some needes args..
  • create a project and set X to Y, add Z.

@VE3NEA
Copy link
Author

VE3NEA commented Nov 11, 2024

On Windows we do not need to rebuild the libraries every time we want to use them. Once built, they work for everyone, on every 64-bit version of Windows. Since the dll's are already available, I do not see much value in describing the building steps in detail.

@zuckschwerdt
Copy link
Member

I'm not really a C# user and I don't develop on Windows, so I don't really know how much effort and guidance is needed to get started. It sounded like some libs would need to be collected and sorted into specific folders to get going?

@VE3NEA
Copy link
Author

VE3NEA commented Nov 11, 2024

Yes. To use SoapySDR in a C# app, one needs to include the bindings assembly (Pothosware.SoapySDR.dll) as a dependency in the project, and copy all non-C# dll's from the example app to their project. No libraries need to be recompiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants