xInterop C++ .NET Bridge 4.0 is available now

xInterop C++ .NET Bridge 4.0 is available nowWe are pleased to announce the release of xInterop C++ .NET Bridge 4.0, a Code Generator for Creating Two-Ways Bridges between C++ Native World and .NET World. Visual Studio 2017 is now supported.xInterop C++ .NET Bridge 4.0 is available to the public for evaluation to anyone who is interested in using xInterop C++ .NET Bridge toGenerating C# .NET Wrapper/Bridge for native C++ DLLs so that you can call native C++ DLL from .NET.Generating C++ Native DLL Bridge for .NET assemblies so that you can call .NET assemblies from native C++.You may want to...

Ultimate Guide to Call .NET Assembly from Native C/C++ Using Unmanaged Exports

I have been mentioning Unmanaged Exports in a few of my articles, which is a very basic technique allowing us to export managed methods from .NET world to native C and C++. The resulting assembly is a mixed mode DLL containing native-like export entry. You can use Unmanaged Exports Nuget Package to create such DLLs, As long as you can write the native C/C++ declaration of the functions correctly, you should be able to create export function with simple and primitive types. But I went further to write an article named Unmanaged Exports, An Ultimate Guide to Call .NET Assembly from...

Calling .NET from Native C++: How to receive C# event

There are a few other technologies we can use to call .NET from native C++ as shown in Introduction to Native C++ to .NET Bridge, such as C++/CLI, COM, Reverse P/Invoke, Unmanaged DllExport, but none of them are easy to implement receiving events from .NET as xInterop Native C++ to .NET Bridge is. Let’s write a sample assembly to demonstrate how we can receive C# .NET events from .NET using native C/C++ code. The sample assembly is quite simple, it has only one class named SimpleWebClient which implements a method named DownloadStringAsync and an event named DownloadStringCompletedEventHandler, as you see, SimpleWebClient basically wraps...

Using PdfSharp for Processing PDF from Native C++ : Watermark Sample

The whole package of PdfSharp comes with lots of sample applications, one of them is watermark sample which shows three variations how to add a watermark to an existing PDF file. You can see the resulting PDF as shown below. The following is the original C# console application of Watermark sample. The C# source code was released under MIT and it was written by Thomas Hövel. C# using System; using System.Diagnostics; using System.IO; using PdfSharp.Drawing; using PdfSharp.Pdf.IO; namespace Watermark { /// This sample shows three variations how to add a watermark text to an existing PDF file. class Program {...

Using PdfSharp for Processing PDF from Native C++ : Hello World Sample

The whole package of PdfSharp comes with lots of sample applications, one of them is the obligatory hello world sample which shows how to create a PDF document with one page and the text “Hello, World!” written in its center. You can see the resulting PDF as shown below. The following is the original C# console application of Hello World. The C# source code was released under MIT and it was written by Thomas Hövel. C# using System.Diagnostics; using PdfSharp.Drawing; using PdfSharp.Pdf; namespace HelloWorld { // This sample is the obligatory Hello World program. class Program { static void Main()...

Enhanced SEHException Handling

The problem with SEHException There is indeed a problem with SEHException handling. Let’s see the definition of SEHException from the official online document. The SEHException class handles SEH errors that are thrown from unmanaged code, but that have not been mapped to another .NET Framework exception. The SEHException class also corresponds to the HRESULT E_FAIL (0x80004005). The .NET Framework often encounters unmanaged SEH exceptions that are automatically mapped to managed equivalents. There are two common unmanaged SEH exceptions: STATUS_NO_MEMORY exceptions are automatically mapped to the OutOfMemoryException class. STATUS_ACCESS_VIOLATION exceptions are automatically mapped as follows: If legacyNullReferencePolicy is applied, all access...

Using PdfSharp, a .NET Library for Processing PDF from Native C++

PDFsharp is the Open Source .NET library that easily creates and processes PDF documents on the fly from any .NET language. The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer. PDFsharp has the following key features, Creates PDF documents on the fly from any .NET language Easy to understand object model to compose documents One source code for drawing on a PDF page as well as in a window or on the printer Modify, merge, and split existing PDF files Images with transparency (color mask, monochrome mask, alpha...

12 New Features of xInterop C++ .NET Bridge with Native C++ to .NET Bridge

We have been busying working on lots of new features of xInterop C++ .NET Bridge for more than a year and I have not been able to find time to write technical article for too long, and I found the last time I wrote about Native C++ to .NET Bridge was 15 months ago. Since then, the features of Native C++ .NET Bridge is getting much richer, actually, the other bridge, .NET to Native C++ Bridge has gained lots of new features too. If you don’t know already, xInterop Native C++ .NET Bridge is based on P/Invoke (PInvoke), Reverse P/Invoke...

Inheriting from native C++ in C# and passing the inherit class backward to c++

How to inherit from a native C++ class in C# and then use the class in native C++? To answer this question, what we need to do from C# is to achieve the following 3 things, Subclass/inherit C++ classes from C# Override C++ methods with C# methods Expose or pass the instances of C# class to C++ as if they were native code Just like using C++/CLI, there is simply no way we can override any C++ virtual method directly using C# class by deriving from the native C++ class, we are talking about two different language. What xInterop C++...

Can I export a C++ interface with C-Style methods to a C# DLL?

This is a question posted right here on the stack overflow web site. None of the answers are completely correct since they do not address the real issue of the question. I consider those answers are work-around and they are not direct solution. With using xInterop C++ .NET Bridge, the answer of course is, YES. In C++, there is really no concept of an interface, the OP referred to the C++ abstract class by stating C++ interface. So let’s change the question to Can I export a C++ abstract class with C-Style methods to a C# DLL? Stating exporting a...
1 2 4
Translate »