Azure functions running 64 Bit native c++ dll

Michael Pine 21 Reputation points
2021-07-25T10:14:26.913+00:00

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

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,352 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,553 questions
{count} votes

Accepted answer
  1. Cristian SPIRIDON 4,471 Reputation points
    2021-07-27T05:32:40.567+00:00

    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.


2 additional answers

Sort by: Most helpful
  1. Michael Pine 21 Reputation points
    2021-07-26T06:44:40.777+00:00

    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 ?

    0 comments No comments

  2. Hochgurtel, Brian D 20 Reputation points
    2024-05-09T19:24:54.6633333+00:00

    I know this is an old post, but I found something that might help others. C++ libraries when compiled are tied to the operating system they are tied to, so you could build your C++ library on Ubuntu with gcc and find your Azure function code works just fine locally. It turns out that the azure functions in the portal are running on Debian, so now your C++ code will fail and potentially throw segmentation faults. We found that our code would not compile on Debian with gcc, and thus went with a custom container outside the Azure Function environment.

    0 comments No comments