Eric,
Let me tell you something about me too...
I've been working with LabVIEW for (just) 4 years. That is, 40 hours a week
professionally, 10 hours a week privatelly. I've started with LV4, and went
through all versions and revisions until 6.0.2 (6.1 will come soon, but
first I have to finish some major projects.
During this time I've been working on lots of interfaces with the windows
OS. Some 'dll' things I've worked on: OpenGL interface, MSXML driver,
keyboard hooks, mouse hooks, GDI interfacing, calling LV dll's from
assembler, calling assembler dll's from LV, creating threads, using serial
interrupts, etc. I'm now (also) working on a way to automatically generate
documentation (much more then the 'export VI stings') from a VI. This
requires 'under the hood' knowledge about how VI's work.
When I had to make a fast routine for a project one time, I choose
assembler, because I had this knowledge. Also, I wanted to use pure SIMD
opperations. The operation had to modify an array of DBL's. The SIMD uses
the same format (IEEE 754, I think), so it was easy. But when it came to
testing, it appeard that the routine only paid off if the routine was 'long'
enough. The routine was n*O^2, where n was a parameter. When the array was
large, and n small, the overhead of copiing the array to modifiable memory
was relativelly large, and the LV routine was faster.
When I get a pointer to a LV array, I can use this pointer to modify the
data in the array. This can (I think) only be done if LV copied this data,
just like LV is doing when a wire is split to be modified.
It might be that this copiing can be prevented, e.g. by using other data
types, or fiddling with threads and reentrance... If you want to optimally
benefit from dll's I'd look for a way to keep the data in the dll space, or
pass it once at initialisation. You could use CreateHeap, HeapAlloc,
AllocGlobal, and other functions. You can use these functions in LV, or in
the dll. Once you have a pointer to the (one and only) data space, you can
use this to pass to the dll functions.
I think LV does not show the memory in question in the profiler, but I'm not
sure.
Using the "Adapt to type" option might just result in a internal convertion
during 'compile' time, and might be exactly the same as doing it yourself.
Perhaps you can share a bit about the application you are making, or at
least why you need the speed you are seeking?
Regards,
Wiebe.
"Eric6756"
wrote in message
news:50650000000500000025C60000-1042324653000@exchange.ni.com...
Greg,
There are two relevant documents which are distributed with labVIEW,
in labVIEW 6i, (hey, I'll get around to upgrading), the first is
titled, "Using External Code in LabVIEW", the second is application
note 154, "LabVIEW Data Formats".
Actually, a statement Wiebe@air made on my previous question regarding
dll calls, "Do dll calls monopolize the calling thead?" provoked this
line of questions. Based on other things he has said, I gather he is
also using dlls. So as long as we're here let me ask the next
question...
If labVIEW must make a copy of the passed data, does it show up as
additional memory blocks in the vi profiler? In other words, can you
use the profiler to infer what labVIEW is doing, or as you put it,
infer whether there is a clever passing method available?
As a personal note Greg:
First, as a one time engineering student and teaching assistant, I
don't recall hearing or using the terms "magical", or "clever". Nor I
might add, do I find them in print elsewhere in technical journals.
While I don't mind NI marketing in their marketing documents, used
here in this mostly educational forum, they strike me as arrogant,
and/or pompous.
I like NI's products because they work and are reliable. I doubt it
has anything to do with magic, has somewhat more to do with being
clever, but is mostly due to the dogmatic persistence of your
engineers. I rather doubt any of them adjoin the term "magical" or
even "clever" to their solutions. I believe the term "best" is
generally accepted with the qualifier "I've or we've found". At
least, that has been my engineering experience.
Second, many of my questions I can sort out on my own, but I figure as
long as your willing to answer the questions, then your answers are
generally available to others. The problem is that one question seems
to lead to another and specific information gets buried in a rather
lengthy discourse. When I come here with a specific question, it
would be nice to find it asked and answered specifically rather than
buried in the obscurity of some other question. As such, at some
point in these discussions it might be appropriate to reframe a
question and put at the top. In my opinion, that decision is
primarily yours as you have a better feel for the redundancy of
questions asked and/or your answers.
Anyway, the next question I'm posting at the top is, "Do the handles
passed to a dll have to be locked down to insure other threads don't
move the data?"
Thanks,
Kind Regards,
Eric