question

MichaelPine-1899 avatar image
0 Votes"
MichaelPine-1899 asked CristianSPIRIDON72 commented

Azure functions running 64 Bit native c++ dll

Hi Community,

I reached out to Azure support via twitter and they suggested I post in here, for any help that might come my way.

I have a .Net5 Isolated function that is running some proprietary c++ dll's, that I have compiled as 64 bit, these run perfectly happy on my local debugging session, i.e --dotnet-isolated-debug, the code runs perfectly fine and I decided to pipeline everything and deploy the function and everything works except for one small snag.

One of the dll's can be called and invoked fine, the other dll gives me the dreaded Invalid image format which from my previous expereince is trying to run a 64 bit dll inside a 32 bit process or vice versa.

If I change the runtime on the function to 32 bit both dll's fail to load which is what I expect to happen, when I change back to 64 but runtime I thought this should be fine but when dll loads and the other does not.

On the dll's I have configured them for CLR support and I the Framework version is set to 4.6.2.

I used sigcheck and that seems to confirm that all of the dll's are 64 bit as I expected and I'm actually not quite sure what to do now and was hoping to maybe get some suggestions to look at, I'm so close with this and I'm just trying to get that final hurdle done.

Any hints or things to look at in terms of the dll's would be much appreciated as I don't think there is anything else I cna configure in the function runtime.

thanks
Michael

c++azure-functions
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @MichaelPine-1899, Welcome to Microsoft QnA. Thank you for the question.
You may refer to this : azure-function-with-native-dll-x64.html and see if this helps.


0 Votes 0 ·

I ask you this question.

Why does this run perfectly fine on my local machine both of the c++ dll's work completely fine, this is running using the Azure Functions Runtime locally but why does it not work when I deploy to the Azure Functions Runtime in a function hosted on Azure ?

Are you telling me that the why the functions work is that you can build/run/debug them locally but there is a caveat that they may not work when you deploy them to the functions runtime ?

I have confirmed both of the dll's are 64 bit and one of them works but one doesn't work how to you explain that ?

0 Votes 0 ·
CristianSPIRIDON72 avatar image
0 Votes"
CristianSPIRIDON72 answered CristianSPIRIDON72 commented

Hi,

I think the dll that is not working requires other dlls not present in Azure environment.

To your specific question, vcomp140d.dll looks like a debug dll that maybe is missing. Is the dll build in debug mode? It should be build in release.

Hope this helps.

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the input, you know I didn't think about the debug build, I will check that, kind of makes sense because there isn't much information about them other than they are the open MP dll's, it's been a bit of a struggle for me as I've kind of inhertited and I am trying to offload the processing into the cloud, I did check the system drive of the function using the kudo console and the dll's are actually there but not the vcomp140d.dll.

Not sure if you know this, just asking how are those libraries linked at compile time ? It's a struggle going back to me c++ days.

I'm just struggling because this all works locally and I even have that vcomp140d.dll file on my local development PC and as far as I'm aware I didn't put it there but it's hard to find out what or how it gets installed

0 Votes 0 ·

Mate,

you freaking nailed it, I went back, I changed everything to Release, rebuilt, everything, re packaged my NuGet packages with my processing libraries, updated them in my function solution, deployed the solution and it worked, I was sure it would just fail but I saw beautiful blue log statements all the way down. I guess I'm still not sure why the other dll worked other than I guess because it didn't reference that functionality.

Honestly I wasn't even thinking Release mode at the moment, never had an issue like with deploying a function but it is the first time I have included native libraries like this, so it will be something to remember.

Honestly I can't thank you enough, I wish I could send you something to thank you other than just accepting the answer.

I know it's a no brainer and I always deploy in Release I just didn't think about it at this stage but I'll actually remember to do it from now on even when deploying into a dev function.

With this though I have moved the company I am now working for, I've moved their processing algorithm workloads into the cloud on a function that can scale as required, it's a huge thing for them.

Thanks again
Michael

0 Votes 0 ·

Glad to hear it helped you!

Thanks for the feedback!

0 Votes 0 ·
MichaelPine-1899 avatar image
0 Votes"
MichaelPine-1899 answered

ANybody following this thread give me any idea about vcomp140d.dll, the only difference I can see between the 2 dll's is that the one that fails has this library imported and the one that works does not have it and it is the only difference I can see, I'm not sure what the dll does other than I can find out is Microsoft C/C++ OpenMP Runtime, so seems to be something that is used to offload work loads to GPU's ? Could this be causing me issues and indicate why it would work on my local PC but would not work in the Azure function runtime as I assume it does not exist ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.