Using a Boost library in a Windows Forms application? - winforms

I have issues when trying to compile Boost in a Windows Forms application.
I was told it is because I must compile using /clr in order to use Boost, and Windows Forms applications default to /clr:pure.
Is there anyway to get around this issue so that I can use the Boost library?

Related

Reference a windows uwp sdk inside a net5 windows app

I have to use a SDK that targets uap10.0.x from a windows application.
I have tried adding Microsoft.Windows.SDK.Contracts and Microsoft.Windows.CsWinRT but it gives build error Failed CLR.
I did some research and discovered a way to add uap in TargetFrameworks.
https://developercommunity.visualstudio.com/t/net-core-cross-target-with-uap/174053
After I did this, I got errors for Windows.Forms and other libraries.
I also tried creating a .net standard library and add the reference there. The build was successful but I got runtime error for Platform not supported when using the library inside the net5.0 app.
I also tried creating compilation constants to only use the library in windows os but the error was the same.
What is the way to go in this case? Is it possible to use a uwp library inside windows app or should I create a uwp project and find a way to start it from the windows app.
Any suggestion is appreciated.
Is it possible to use a uwp library inside windows app ...
No, if the SDK only targets the uap10.0 target framework moniker (TFM), you cannot use it in an app that targets any other framework than UWP.
A TFM, such as for example uap10 or netstandard2.0, specifies a set of APIs that are available to the library or app. If you want to be able use the SDK from both UWP and .NET apps, it should target .NET Standard.
Please refer to the docs for more information about target frameworks and TFMs.

How to develop OSX application using Visual studio for Mac preview

I have .Net Winform project(c#) working in windows.Now,i want to do same project, to work as OSX App in Mac. As per my understanding Microsoft recently launched Visual studio for Mac preview and also it support OSX app development using Xamarin.Mac and also it support .Netcore .
Instead of creating Osx app from scratch,i need to reuse the code which is available in .net winform project.
can i develop UI application using .netcore project? I think .netframework and .netcore more or less same.can i port .netframework to .netcore project and create osx app ?
or
can i use xamarin.mac and reuse the .netframework c# code to create osx app?
I am new to this,so kindly suggest the best way to create OSX app using Visual studio for Mac preview. (Basically i need Tabel view,form controls and graph(there i use zedgraph).Is these view are available here.
In general, the "standard" way of developing cross platform applications is to separate as much of your logic as possible into shared libraries of some type and create "thin" UIs specific to each platform.
Depending on your need, you could easily make that shared code netstandard/PCL/etc compatible and share between platforms or just recompile the project in each solution.
NSTableView will likely solve your needs, but expect it to be significantly more primitive that what you are used to on Windows. Graph controls don't come built in, so you'll need to find a vendor that ships Cocoa controls or draw them yourself.
Here is the quickstart documentation.
Xamarin.Forms support for macOS is coming in the future, currently earmarked for Q2 this year.

How can I incorporate a C project in Xamarin Forms?

I have a project, written in C which I want to use in Xamarin Forms. What is the best way to use this code? Generate libraries for each platform?
What I'd prefer is to have one wrapper that I can use in shared code that doesn't have to be implemented for each platform.
Unfortunately, the way binding works is different for Android and iOS, so you would need to generate libraries for each platform.
You can read more about how that is done here for iOS and here for Android. For iOS, you can consider using Objective Sharpie which will do the most of the work for you.
Afterwards, you can simply use DependecyService to access the native platform features.

What is the difference between GTK and Win32 Native API in C?

I'm a beginner in C programming. I read about some tutorials and forums about creating GUI application in C. I encountered some terms like GTK, Win32 native API. They say that GTK is one of the library to use in creating GUI application. I also tried the code that create a simple window using Win32 API. What are the difference between them?
Thanks.
GTK is multi-platform tool kit for creating graphical user interfaces(GUI).
In short they provide a framework which you can use as an library for developing your UI applications.
Win32 API is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. These are restricted only for windows platform.
The language rules for c/c++ are governed by ISO standards which define what functionality every standard c/c++ implementation has to provide.Note that both of above provide some functionality that is over and above what the standard libraries provide.Basically, they provide you boiler plate framework for easy usage instead of reinventing wheels for your project.
Win32 is the "native" API for Microsoft Windows. You can only run it on Microsoft Windows.
GTK+ is also a GUI library. You can run it on multiple different platforms.
Qt and SDL are other multi-platform libraries. Like GTK+, the same GUI can be recompiled to run on multiple different platforms: Windows, Linux, MacOS, etc etc.
Gtk+ = cross-platform and very powerfull. more simple than win32. more tools you will have.
win32 = just in windows. standard windows GUI framework.
and DUDE! Gtk+ in windows is a pain in the ass. but for any othe supported platforms I reccomend Gtk+ for a widget toolkit.

CUDA integration with Windows Forms/WPF

Currently I have a console application, which is fine for me, but not for others. I need to create a GUI. I am developing for Windows 7 using Visual Studio 2010 and CUDA 3.2 build customizations.
Can I simply create a GUI in Windows Forms / WPF and then just state an extern "C" function, that will be resolved to a function calling a CUDA kernel? I tried to do so just now and I had a lot of compilation errors, including some CLR stuff. After a quick googling I have the impression, that it isn't as simple as it seemed.
-- edit
The generalized question is: how to include CUDA code in C++ Windows Forms / WPF application?
My partner and I had the same problem. We decided to write GUI in C# Windows Forms because of simplicity. However, we couldn't find any way of using CUDA in the same project (not even for Managed C++). There might be some way of doing it, but here is our solution: we created another project which was written in native c++ and produced dll file. Then, we used P/Invoke (Platform Invoke) in C# so, that we could call exported functions from dll. In the dll, there should be kernel and some device functions, but you should create another function which calls kernel and which will be exported. You can google P/Invoke and find out how to import native c++ functions from dll to c# application.
If you're using Visual Studio 2010, you can get started by downloading Cuda Toolkit v4.2 and then downloading CudaFy.net. A search for each on google will get you to the correct pages. Then you make sure nvcc is running. It is necessary to compile C# code into low level (cuda) code. You can then download sample apps to test how they work. You can start here

Resources