I have created a vanilla C DLL using VS2008 that connects to a 3rd party C DLL This DLL works fine and I went this route because I could not connect to the 3rd party DLLs using C# or VB.NET.
I have created a small VB.NET text EXE application to connect to my C DLL. This works fine and returns the required values. So my VB.NET test EXE > my C DLL > 3rd Party C DLL works.
I have pasted the 18 lines of code from my VB.NET standalone EXE test application into a very simple AutoCAD VB.NET class library DLL which I netload into AutoCAD. Those 18 lines of code no longer work. I can debug up to the DLL call but then it throws an exception and says it can't find the procedure. It gives the same error if I completely delete my C DLL.
If I copy my standalone EXE into the debug folder where all the DLLs are located it is able to access my C DLL no problem. The debug folder is in the AutoCAD path so AutoCAD can find my C DLL no problem.
Hi,
without seeing these 18 lines and not knowing what type of DLL the 3rd party DLL is I can only guess, but nor more.
I assume that the 3rd party DLL is also a Framework-based DLL and then I would look to :
A few ideas for now (to start), other ideas may follow by others 😉
Good luck, - alfred -
Thanks for the tips.
I believe the 3rd party DLL is straight C or C++. It is definitely not .NET otherwise I wouldn't need a C DLL to interface to it.
Everything is 32-bit but I do compile the .NET test EXE and AutoCAD DLL to AnyCPU.
My AutoCAD DLL never talks to the 3rd party DLL it goes through my own C DLL. I tried setting my C DLL as a reference but that didn't affect anything.
I like the idea that the DLLs can't find each other. My one test of putting them all in the AutoCAD path wouldn't have helped. Maybe I could try setting the working path just before calling the DLL.
There is one benefit to my final solution is that the DLLs don't stay loaded in memory. When you call a DLL from .NET it doesn't release it until you shut down AutoCAD, whereas by having a small EXE access the DLL, it frees up the memory right away.