How to call external DLL from igor?

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.
Nadenon wrote:
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.
What type of CCD camera? Have you tried that NewCamera from Igor Pro 7 does not suit your needs?
Thank you for thinking about this. The ccd camera is provided from our group company. Statics DLL? is prepared for customers. I will attach the documents about the DLL. I thought I will be able to communicate the CCD camera by Igor6.2 via the DLL easily, if it will difficult for me I will make aquisition program by using Labview and I will make a DDE commnication program by Igor. I could communicate the SDD X-ray energy dispersive detector by using this metode before. I should constructed the measureing system as soon as possible. But in this case, I would tried to control the ccd only by using igor because it will become a simple program of aquisition system.
A super hacky solution, in case an xop is too much, might be:

1) reading the functions in the dll with dependency walker or similar
2) 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
thomas_braun wrote:
@sk: Have you ever done that? AFAIU this will load/unload the DLL on every call and most libraries I worked with don't like that.


You are right on both accounts.

Here is a quick test:
function rundll32(s_dll, s_func, s_arg)
    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("printui.dll", "PrintUIEntry", "/?")

rundll32("user32.dll", "LockWorkStation", "")


best,
_sk
Nadenon wrote:
Thank you for thinking about this. The ccd camera is provided from our group company. Statics DLL? is prepared for customers. I will attach the documents about the DLL. I thought I will be able to communicate the CCD camera by Igor6.2 via the DLL easily, if it will difficult for me I will make aquisition program by using Labview and I will make a DDE commnication program by Igor. I could communicate the SDD X-ray energy dispersive detector by using this metode before. I should constructed the measureing system as soon as possible. But in this case, I would tried to control the ccd only by using igor because it will become a simple program of aquisition system.

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.
thomas_braun wrote:
@sk: Have you ever done that? AFAIU this will load/unload the DLL on every call and most libraries I worked with don't like that.

@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.



Just a upvote for Thomas. He wrote a custom XOP for Basler cameras for me. Works well.

Andy