How to call external DLL from igor?
Nadenon
Wed, 03/21/2018 - 02:51 am
I have had an ccd camera and it's software. I would like to drive the ccd camera by using igor. The software has DLL. I would like to call the DLL from Igor. I bought an Igor XOP toolkit7. AIthough,I don't have visual C++ and I'm not a programer. please show me how to control the camera by igor via dll. On the other hand, I can use a Labview program and it has already prepared the node for " calling dll code". It was useful when calling the external dll to labview. I wish anyone supporting me to build the XOP smiliar to the labview node.
Writing a camera XOP is not trivial even when you are a seasoned programmer. You do indeed need the XOP Toolkit, VC++ and experience writing code on Windows. Since you say that you are not a programmer I recommend first checking to see if an XOP was already written for the particular camera. Otherwise be prepared for a steep learning curve to master the required details.
Normally, with camera SDKs I use a static library that provides all the routines you need to communicate with the camera. If you have to use a DLL you should look at the LoadLibrary() function.
A.G.
WaveMetrics, Inc.
March 21, 2018 at 10:31 am - Permalink
March 21, 2018 at 12:13 pm - Permalink
March 21, 2018 at 05:22 pm - Permalink
1) reading the functions in the dll with
dependency walker
or similar2) use:
rundll32.exe dll_file, function_name arguments
to test (rundll32 help)3) call the functions from within Igor with
ExecuteScriptText
(displayhelptopic "ExecuteScriptText"
)best,
_sk
March 22, 2018 at 01:39 am - Permalink
@Nadeon: There is a list of third party consultants listed at https://www.wavemetrics.com/products/thirdparty/developers.htm which can help with the XOP writing.
Disclaimer: I'm on that list too.
March 22, 2018 at 02:56 am - Permalink
You are right on both accounts.
Here is a quick test:
string s_dll
string s_func
string s_arg
string s_cmd
sprintf s_cmd, "RUNDLL32.exe %s,%s %s", s_dll, s_func, s_arg
executescripttext s_cmd
end
rundll32("user32.dll", "LockWorkStation", "")
best,
_sk
March 22, 2018 at 05:55 am - Permalink
FYI, Igor 7 and beyond have dropped support for DDE, so if you go that route you're locking yourself into using an already very out of date version of Igor. Writing an XOP is most likely the "right" way to do this. I took a very quick look at the SDK documentation you provided and I think writing an XOP would be relatively straightforward for someone who is familiar with XOP writing.
March 22, 2018 at 06:49 am - Permalink
Just a upvote for Thomas. He wrote a custom XOP for Basler cameras for me. Works well.
Andy
March 22, 2018 at 09:22 am - Permalink