I am trying to upload a blob in the Azure storage and it uploads successfully. Now the next step is to process the blob with C++ code. Since Azure function does not support C++ how can I process the blob?
-
1you'd have to first build your binaries and ensure that you are able to run them from .net/python/javascript code. once you are able to do that, now you can upload those binaries together wherever you've published your azure function. – Alex Gordon Jun 03 '19 at 17:22
2 Answers
Azure Function support running .exe
executable file. So I suggest generating your cpp program exe file, then upload it to Azure Function and run the below sample code.
using System;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = @"D:\home\site\wwwroot\TimerTriggerCSharp1\testfunc.exe";
process.StartInfo.Arguments = "";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
string err = process.StandardError.ReadToEnd();
process.WaitForExit();
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}

- 13,703
- 2
- 11
- 26
By now on Azure Functions as the comment said, there are .NET, Python, Node.js, Java supported, no C++.
However, if you are working on Linux, you can consider for calling C++ in Python or Node.js, such as following the documents for Python with Extending Python with C or C++
or for Node.js with C++ Addons
. I think there are simpler for you to use event grid with Azure Function.
And there is an existing SO thread about Calling C/C++ from Python? that you can refer to.
Or else for working on Windows, the other solution is to compile your C++ code to a dynamic library in Visual Studio, and then you can invoke the dll lib in C++ from C# code. Please refer to the MSDN document Calling Native Functions from Managed Code
to know it, or refer to the SO thread Possible to call C++ code from C#?.
Hope it helps.

- 23,476
- 4
- 25
- 43