NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

(Un)Managed Wrapper calling LabView-Dll

Solved!
Go to solution

Hello,

 

I am focused with a strange behaviour which i could not explain.

 

I had to extend the NI272x in my C++ unmanaged environment for a StepType http://sine.ni.com/cs/app/doc/p/id/cs-11443/lang/de/pdf/yes/pdf that descripes a functional testsystem.

Unfortuanately NI provieds no C Api for this devices. But LabView drivers were available. So i made LabView Wrapper
to consume it. This is worked fine.

 

A current extension development is done in C#. It loads the old unmanaged StepType-Dll during runtime. If the LabView Dll is
used. I am not able to load the DLL with C# via SDK LoadLibrary to memory.

 

To understand whats going on i have provied a small project that descripes the task.

 

Regards

Juergen

 

 



  

 

 

 

  

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 1 of 3
(4,340 Views)
Solution
Accepted by topic author j_dodek

I believe the problem is that the dll you are loading has dependent dlls. The normal behavior of LoadLibrary does NOT automatically look for dependent dlls in the same directory as the dll you are loading. You should use LoadLibraryEx with the LOAD_WITH_ALTERED_SEARCH_PATH option instead (This is what teststand uses when loading dlls with the c++ adapter). See Microsoft's help info on MSDN for more details about LoadLibraryEx and LOAD_WITH_ALTERED_SEARCH_PATH.

 

Hope this helps,

-Doug

Message 2 of 3
(4,308 Views)

Hi Doug,

 

you are right LOAD_WITH_ALTERED_SEARCH_PATH did the trick.

Thanks for pointing out

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 3
(4,290 Views)