Can I use native DLLs in Hangfire jobs?

Hi! I have Hangfire up and running beautifully with a few of our C# tasks. I’d like to move completely to Hangfire, but some of our existing tasks call into C++ DLLs. Doe sHangfire support executing such objects? Where should I place the DLLs so that Hangfire can find them at execution time?

These tasks also wait for callbacks from the DLLs. I’m assuming that if I use a sleep/wake cycle with a member variable (false until the callback executes, then true), I can keep the task executing within Hangfire so that it doesn’t get disposed of until the callback fires? Is there a smarter way to handle that scenario?


You can think of Hangfire in this case as a simple wrapper around regular separate threads. Everything possible with .NET is possible in background jobs.

Side-by-side with application that instantiates the background job server.

Use regular synchronization primitives as usual.