LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW not seeing Occurrence set in DLL

It doesn't crash, but it doesn't work, either. I've tried assuming LV is passing a *RefNum, or a RefNum, or a **RefNum - no luck with any of them. I have contacted tech support, who said they don't have much experience with calling occurrences from dlls, but they'd look into it if I sent them my sample code (which I've done).

I'm starting to think that the problem is that I'm using Borland to create the dll; it's the only factor that's different between the example I downloaded that works, and my code that doesn't work.

Thanks for your help, it's much appreciated.
0 Kudos
Message 11 of 14
(786 Views)
For what it's worth, I just created a DLL call, passing an Occurrence Refnum, and got the prototype:

long MyOccurrenceFunc(LVRefNum *MyOccurrence);

in other words, a POINTER to the RefNum.

This is in LV 6.1; I know of no errors in this regard about 6.1.

You could typecast the RefNum to an I32 and display it before the call, then in the DLL, spit the refnum back out in an I32 parameter, and compare them in the LV subVI...

You do know, I assume, that you have to close the VI that calls the DLL to unload it before you can use a new one, don't you? Visual C warns you about this, I don't know about Borland. If you leave the VI open, the linker cannot create a new DLL file, bec
ause the existing one is in use.

Sorry I can't help any further...

Thanks for your help, it's much appreciated.

Then give me a rating.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 14
(786 Views)
I've (kinda) found the problem - I built the DLL under LabWindows/CVI, and it works perfectly. So the problem obviously is with Borland, or rather the way that I got Borland to see LV's Occur() function (briefly: Borland can't use labview.lib, so I used lvrt.dll and implib to create a lib that Borland can use - this obviously didn't work as well as I thought it did).

You do know, I assume, that you have to close the VI that calls the DLL to unload it before you can use a new one, don't you?

Yes, I did - and fortunately, Borland does warn you as well.

Then give me a rating

Will do - it's well deserved.
0 Kudos
Message 13 of 14
(616 Views)
My last posting on the subject, just for posterity (and anyone else who comes along later with a similar problem):

It now works, using Borland. The problem was that I didn't create a .lib for lvrt.dll properly: I followed the instructions at http://www.bcbdev.com/articles/vcdll.htm, but in my new .def file I only created an alias for Occur, and not all the related functions (such as AllocOccur, etc). Once I recreated the .def file, and then recreated my .lib file, everything works perfectly.
0 Kudos
Message 14 of 14
(616 Views)