I inherited a UWP application and I need to add additional functionality that needs to be implemented in C++. Therefore, I'm building a C++ WinRT assembly that will expose functionality that the existing UWP C# application will need to consume.
To that end, inside of that C++ WinRT project, I'm trying to make use of the [WindowsRuntimeStreamExtensions][1] class in a C++ file. I cannot seem to find a header file on my system which declares the WindowsRuntimeStreamExtensions class, and trying to reference it using the managed C++ keyword "using" as such:
#using <System.IO.dll>
..gives me the following compiler error:
"WinRT does not support #using of a managed assembly"
Related
I want to learn C++ on my Mac computer. A lot of forums recommend using Xcode, but when I downloaded it I realized that it only has options for Swift or Objective-C. Is there still a way to use C++ in Xcode?
The parts of a problem that interact with system APIs for making an app have to be Swift or Objective-C. (As such, the project templates that give you the bare skeleton of an app to get started with are only Swift and ObjC.)
However, an Objective-C app can use C++ internally. Just create .mm files instead of .m (or rename the ones you have from the project template) so that the compiler knows you're writing Objective-C++. Then you can write ObjC classes that create C++ objects or call into C++ libraries, write C++ classes or templates that store pointers to ObjC objects, etc.
I need to send data via bluetooth from iOS app into a C++ application. So
I have to implement Bluetooth module in c++, in iOS app using Corebluetooth framework.I created a wrapper class of bluetooth module for C++ app. I can call the iOS function from C++ application but, C++ doesn't have Corebbluetooth. Is it possible to create wrapper class for corebluetooth to use with C++ ?
If possible how to create the same?
Yes, that is possible.
You just need to create an Objective-C++ wrapper that forwards the messages to your C++ code. Objective-C++ allows you to use C++ code in your Objective-C classes. To use it, you either need to set the extensions of source files with your Objective-C wrapper from .m to .mm or set the sources to Objective-C++ in the File Inspector in Xcode.
Link grammar is a piece of software allowing for sentence parsing. It has an API that I hope to use (Details here) however the example is written in c++ and I'm a vb.net user. I've tried adding a reference to the file named:
link-includes.h
But vs2010 doesn't allow me to select this file since it's not one of the recognised file types for a reference. I've tried adding the above file to the solution but that doesn't allow me to reference it in any way (as far as I know). Any advice/hints/suggestions would be welcome!
A VB.Net project can't directly reference a C++ header file. In order to use C++ code from VB.Net, one of the following approaches will need to be used:
Compile the C++ code to a native DLL, which the VB.Net code can then P/Invoke
Compile the C++ code to a native DLL, which is then exposed via COM
Compile the C++ code in a C++/CLI project, which the VB.Net project can reference as another managed project (i.e., via project References)
Additional information can be found here: Invoke Native C++ DLL from .NET Code
I have a visual studio 2005 c++ project (that uses QT framework). I would like to reference and use a .net 4 library that I have via COM. I know that if I have a .net project (.net 2 or .net 3.5) in 2005, I cannot reference the .net 4 library but I am curious to know if I would have any issues trying to use it in a c++ project thru COM. I'm not at a point were I can create and test a proof-of-concept application yet so I was wondering if anyone else has tried this or know anything about it.
Thanks
Using COM is a fine way to get the CLR loaded so you can execute managed code. But you'll have to use COM programming techniques in the C++ code. Using Add Reference doesn't work, that's a option that's only available if you write managed code in the C++/CLI language.
One good way is to use the #import directive in your C++ code. That can load a type library and auto-generates smart pointer types and method wrappers that you can directly call in your C++ code. Generate the type library you need with the Tlbexp.exe utility or the Regasm.exe /tlb command line option. QT has built-in COM support as well, I don't know enough about it.
What is the simplest way to use a C++ header file in a VB.NET application?
I need to access an API defined via the header file for a custom VB.NET windows app.
Use the VB.NET Declare statement to redeclare the API function in your code. This will not work if the header file contains classes, you'll need to write a wrapper to make those usable.
Use the PInvoke Interop Assistant to convert the C++ header into PInvoke declarations.
If you have the full source code for the C++ project use C++ Interop as advised by whunmr.