Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Where to place dependent DLL files for Add-in?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
vijay.shindeSLE5F
314 Views, 3 Replies

Where to place dependent DLL files for Add-in?

Hi BrianEkinsMattWynn,

 

We have developed an add-in for Fusion 360 which has dependency on some third party DLL. So, now we have main add-in DLL and one more DLL file for dependent library.

 

When we placed both add-in and third party dll in "%appdata%\Autodesk\Autodesk Fusion 360\API\AddIns\MyAddin" folder then we are receiving below error while loading our add-in.
Add-in load issue.png

We tired placing third party DLL under resources folder. In this case we didn't observed this issue, but add-in fails to load.

 

Is there any way we can mention dependent DLL and it's path within Manifest file?

 

Can you please help us here with placing dependent DLL at correct location to load add-in successfully.

 

Thanks in advance.

Labels (4)
3 REPLIES 3
Message 2 of 4

Hi boopathi.sivakumar,

 

Can you help us with the issue.

Message 3 of 4

You didn't mention if you were using C++, but I'll assume you are. If you are then the default path it will search is the Fusion360.exe directory (and a bunch of others). 

There are a few ways round this in code, assuming you're using late binding to bring in your 3rd party DLL? If so specifying the 3rd party DLL to be Delay Loaded will give you a chance to change where the DLL is searched in your code for before it is actually loaded.

You could in theory LoadLibary() it yourself with the correct path and when it goes to look for it later when required, it should find the in-memory version first. There might be security updates which means this old method doesnt work anymore

The way I've done it is to specify it as Delay Loaded then at the start of my add-in I get the path to my add-in DLL and carefully add it to the overall DLL search path using SetDllDirectory() a Win32 function.

You can use GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)&Anyfunctioninyourdll, &hm) to get a module handle which you can then pass into GetModuleFileName() to get the name & path of your addin dll file, which you can then use to alter the path for DLL lookup.

Hope this helps


Message 4 of 4

Hi chris.monachanZWSCF

 

Thanks for your reply.

 

Yes, add-in is developed using C++. We have placed third part DLL in Fusion360.exe directory. We wrote a PowerShell script to copy DLL to Fusion directory while add-in is installed.

 

Now it's add-in is loaded successfully.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report