LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why this type-coercion dot at WRITE FILE?

Coercion dot yes!

Buffer NO!

Look for the small red circle I used to highlight the new buffer allocation.

This is NOT the case with the odd construct.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 11 of 36
(1,725 Views)
What about use flatten the typeref to string first and write the string to file instead?


Well, then you are guaranteed to make a copy of the data. That's exactly what I'm trying to avoid.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 12 of 36
(1,835 Views)
Look for the small red circle I used to highlight the new buffer allocation.


I used LV 7.1 on the Mac to open your code. I used the SHOW BUFFER ALLOCATIONS tool and I see a buffer allocation at each WRITE FILE function, whether or not you use the weird typecast. It's little black squares that flash on the function icons, not a red circle.

In other words, the typecast does nothing at all to affect the code. (That's what I would expect.)

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 13 of 36
(1,711 Views)
Hi there,

Yes I'm sorry I went too far and forgot about the basics...

If your requirement is to write a datalog file without duplicating data, then I guess you can,

1. contact NI and ask them to fix their VIs (they should fix the VIs anyway);
2. wire DATALOG TYPE with a constant and try not to let the two troubles trouble you.

Afterall I don't see a perfect solution right now that would meet all your needs, other than getting a fix from NI that is.

Dan
Message 14 of 36
(1,813 Views)
Unless this acts different on a MAC?

Here is the screen shot again.

I do not get the buffer allocation with the strange construct.

You do?

Baffled,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 15 of 36
(1,706 Views)
I forgot the screen shot!
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 36
(1,703 Views)
I verified again. With the weird typecast (which ought to do absolutely nothing, right?) wired into the DATALOG TYPE of the NEW FILE function, then BOTH of the WRITE FILE functions have a new buffer allocation (little black square).

This is LV 7.1 / OS X

It's possible that the Windows version says that it only needs to allocate ONCE, since there's not really any difference, and the Mac version is not that smart yet. I don't know.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 17 of 36
(1,719 Views)
Hi Ben,

I'm running LabVIEW on Windows 2k and I get the coericion dot and buffer allocation on file write VI.

CoastalMaineBird has mentioned that there is a miswire in your VI. The boolean should be wired to DATALOG TYPE instead of the OVERWRITE (F) input.

Dan
Message 18 of 36
(1,696 Views)
Thank you!

I missed that.

Please disregard all my previous comments.

Yes we have a buffer being created.

sigh,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 36
(1,688 Views)
Yes we have a buffer being created.


Alright, we're back at square one. The weird typecast does nothing (which is a relief in itself).

The question remains, why does a TYPEDEF incur a buffer-creation / type-coercion penalty, where an equivalent non-TYPEDEF structure does not?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 20 of 36
(1,675 Views)