web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Dynamics AX2009 calling 32 bit dll inside 64 bit instances of AOS

(0) ShareShare
ReportReport
Posted on by

Hello

My AOS is running on a 64bit machine. I need to run a class with property RunOn set to "Server"

The class calls a dll (x86) which is just a simple wrapper to a pretty old dll of an external company.

I always get an error:

ClrObject static method invocation error.

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Can someone please help?

*This post is locked for comments

I have the same question (0)
  • Dick Wenning Profile Picture
    8,705 Moderator on at

    place the dll in the GAC, and try again.

  • Community Member Profile Picture
    on at

    sorry I forgot to mention...it is registered in GAC

  • Verified answer
    Brandon Wiese Profile Picture
    17,788 on at

    In general you can not load a 32-bit DLL from a 64-bit process.  Windows itself goes through a lot of under the hood magic by having one DLL of each kind under either C:\Windows\System32 or C:\Windows\SysWOW64 and automatically swapping in the correct DLL regardless of the path used.

    I have solved this problem in the past by hosting my 32-bit DLL in a web service process, which you can make 32-bit, and then calling the web service from the AOS server tier.  This is also far more stable, as DLL's can be somewhat dangerous to load in-process with the AOS.  For example, one I have tried to use was not thread safe and required synchronization to use safely, and that's more headache on the AOS with semaphores and such than its worth.  Another one caused the AOS memory to bloat and the service to hang sporadically.  The web service approach protects your AOS from all of these problems.

    Good luck!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans