Building Shared Object for LabView
All;
I'm trying to build a C++-based shared object to be called from LabView and use SunCC instead of gcc. The compile stage looks like:danny@traveler:~/tubes/dielectric/rod_software/lookup> make -f Makefile.unix suncc=1
sunCC -I/usr/local/lv71/cintools -I/home/danny/src/NR_C301/code -c -KPIC -m32 -Di686 lookup.cc
"/home/danny/src/NR_C301/code/interp_1d.h", line 183: Warning: n hides Base_interp::n.
"/home/danny/src/NR_C301/code/mins_ndim.h", line 103: Warning: n hides Linemethod<extern "C" double(const NRvector<double>&)>::n.
"lookup.cc", line 176: Where: While instantiating "Powell<extern "C" double(const NRvector<double>&)>::minimize(const NRvector<double>&)".
"lookup.cc", line 176: Where: Instantiated from non-template code.
2 Warning(s) detected.and the load stage fails like this:sunCC -G -m32 -o lookup.so lookup.o /usr/local/lv71/AppLibs/liblvrt.so.7.1 /usr/lib/libGL.so /usr/lib/libOSMesa.so.6
/opt/sun/sunstudio12/prod/lib/crtn.o:(.text+0x0): multiple definition of `_etext'
make: *** [lookup.so] Error 1Is my problem obvious? Is there a simple example on how to build SOs? I found the switch definitions in the Sun documentation, but no good examples yet.
...Dan
If your library links to other shared libraries, use -L options to point to directories other than system directories, and the -l option for the library name after "lib".
When building shared libraries, you also need to list all system libraries explicity, unfortunately, to ensure your library has the right dependencies.
You should also add -zdefs to force the linker to complain about unresolved symbols. The default when building shared libraries is not to warn about them.
You want to be sure you have included all the needed libraries in the link.
Your link command should look like this :
sunCC -G -m32 -o lookup.so lookup.o -zdefs \
-L /usr/local/lv71/AppLibs -llvrt.so.7.1 -lGL.so -lOSMesa.so.6 -lCstd -lCrun -lm -lcYou don't need a -L option for /usr/lib or the directories in the Sun Studio installation. The CC driver knows where to find system libraries.
That said, I don't think the command line issues are the cause of the multiple definition error.
Binaries created by Sun C++ are not compatible with binaries created by other C++ compilers like g++. Is liblvrt.so.7.1 a g++ library?
Similar Messages
-
How to use g++ to build shared libraries for labview in linux?
does anyone knows if it's possible to compile a shared library in linux with g++ that could be recognized by labview?
thks
JPHi JP,
Yes you can use g++ to build shared libraries that labview can use. You'll want to give your C++ library a C interface. This is really common practice. You can do this by simply declaring functions as 'extern "C"'. Here is a link with more information:
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-30.8
I've personally worked on projects that do exactly what you want to do. -
Imlementing synchronized access to shared objects in LabVIEW OOP
Many objects in object-oriented programming have an
identity, such as a file, a front-panel object or a hardware device.
These objects cannot be modelled using present LabVOOP (LabVIEW Object Oriented Programming) objects as
LabVOOP objects gets copied as wire is branched; multiple different
wires cannot all represent a single object. This issue has been
irritating the community of LabVIEW users since the release of LabVOOP
a few months ago.
It seems that there is a huge demand for
objects with unique identity i.e. by-reference objects in LabVIEW. The
central problem why LabVOOP propably doen't have these objects is the
difficulty in implementing synchronized access to these objects from
multiple parallel threads. The problem of synchronized access can be
divided into two different separate topics. First how the
sychronization should be implemented in LabVIEW runtime engine. Second
how this synchronization mechanism should be visible to the developer.
I'd like to start this thread to discuss these two issues.
Synhronization under the hood
Traditionally
people talk about locking of an object and about get-modify-set pass
when accessing the object. Locking is traditionally done by acquiring a
mutex for an object, modifying the object and releasing the mutex so
that other threads can access the same object instance. This is how
inter-thread synchronization is traditionally done. However, besides
the mutex based locking, the computer science community has innovated
also different kinds of methods on synchronizing the access to objects.
One way to get object-level synchronization is modify the
runtime engine so that it only allows a single method of a synchronized
object to run at any time. This mechanism of syncrhonization is
implemented in programming languages like O'Haskell, which is a Haskell
variant with object orirented features.
Also different
transactional mechanisms[1,2] have been successful. In transactional
mechanisms multiple threads are allowed to access a synchronized object
simultaneously. As each method accessing an object commits their
changes, they verify that no other object has modified the object
simultaneously in a manner than would break the transaction. If such a
modification has occurred, everything is rolled back. Transactional
mechanism do not suit to every possible situation as not everything can
be rolled back. For example it's hard to roll back an action that
somehow modifies the physical world.
User experience of synchronization
How
the synchronization is generally implemented in LabVIEW shouldn't be
directly visible to the developer end-user. The developer should
understand the general concepts of synchronization to take full
advantage of it, but in general the synhronization mechanism should be
integrated directly to development environment. There should in general
be no need to acquire a mutex by calling acquire mutex node but instead
the end-user should be able to specify which data needs synhronized
access in more sophisticated way.
In the following I propose a
mechanism of integrating the synchronized access of by-ref objects to
the development environemnt of LabVIEW. The proposal is very
preliminary but I hope it breaks the ice and the community would start
innovating in how should NI implement the syncrhonization support in
the user interface of LabVIEW.
Wire level synchronization
Only
methods can access object private data members. In synchronized access
to the object, it's the methods accessing the private data members that
need to be synchronized. The private data members are accessed by
applying unbundle node to the class wire and data is written back to
the object using bundle node.
What I propose is the following.
An unbundle node could either be normal or "synchronized". A
synchronized unbundle would guarantee the access to the private data
members in synchronized manner. All data wires originating from
synchronized unbundle would be of synchronized type, in a little
similar manner as a dynamic dispatch wire is of special dynamic
dispatch type. Such a wire must evetually be connected to a bundle
node. When the wire is bundled back to the originating object, the
synchronization requirement is released.
These synchronized
wires would look somewhat different from normal wires so that the
developer instantly knows that the wire is synchronized. The developer
can branch the wire, but only one wire branch can own the synchronized
type. The developer could easily select which wire would be
syncrhonized by Ctrl+clicking the wire. Such a wire can be considered
as a combination of a data and a mutex, even though mutexes don't need
to be the underlying synchronization method. The wire just guarantees
that there is a mechanism in the runtime engine that makes sure the
access to the wire data is synchronized.
There is a need to wire
data originating from a non-synchronized wire to a synchronized wire so
that it can replace the private data member of the class. This is
accomplished with a new node similar to bundle node, that would allow
replacing the data in a syncrhonized wire with some data originating
from a non-synchronized wire.
The synchronized wire can be
connected to a front panel controls of special syncrhonized type. This
way the synchronized wire can originate from a method and allow passing
the synchronized data to the calling VI and back to another method.
This is practical for example in a situation when the developer wants
to run different analyzes to a data class but don't want to rewrite all
the existing data analysis tools as class members. So the developers
writes a syncrhonization acquiring getData method that let's the
calling VI to access the syncrhonized data. Then the developer passes
this data to an analysis VI and passes the result back to a setData
method that writes the result back to the class wire.
There
will probably be technical problems in allowing the user to connect
such a synchronized wire to all existing VIs since these VIs. Therefore
the programming model for all nodes that do not support such
synchronized wires will be branching the wire and passing the
non-synchronized wire branch to the node and then bundling the result
back to the synchronized wire.
To increase performance and
decrease unnecessary buffer copies when a syncrhonized wire is
branched, if the syncrhonized wire continues directly to the new bundle
synchronized wire node, no buffer copy is made.
Discussion
The
syncrhonized access to a by-ref LabVOOP objects can be implemented in
multiple ways by National Instruments. The synchronized access should
be divided to two different and independent parts: 1) the user
experience of synchronization and 2) the runtime engine synchronization
mechanisms. As LabVOOP objects have special properties compared to
other LabVIEW data types, optimal user experience can be gained by
designing the user experience specifically for LabVOOP objects. From
user experience point-of-view this syncrhonization mechanism may not
work for other data types. Separating object syncrhonization from
synchronization of other data types is advantageous also for other
reasons. Due to the fact that object data can only be accessed via
object methods, more advanced synchronization methods may be used with
objects than can be used with other data types. O'Haskell
synchronization implementation is an example of this. Integrating the
synchronization directly to the user interface allows NI to change the
mehcanisms under the hood, when computer science comes up with more
advanced methods. Therefore NI could begin with traditional and quite
easy mutex-based synchronization and later move to more advanced
perhaps transaction based syncrhonization methods or even combinations
of multiple different methods.
I hope this topic generates
discussion that would help NI to implement an excellent synchronization
mechanism in LabVOOP. I hope that all talented individuals in the
community participate this discussion to help NI to reach this goal. I
also hope that if you just have time, it would be great if you could
surf the computer science resources to find out what kinds of new
techniques there exists for synchronizing access to shared resources. A
Large community may find much more innovative solutions than a few engineers at NI. Let's give NI the power of open source design
Tomi MailaHello Tomi,
First, thank you for taking the time to write such a well
though-out suggestion. Are you familiar
with the “LabVIEW Object-Oriented Programming: The Decisions Behind the Design”
document? I think the reason we chose to implement a ‘by
value’ strategy, is that is more in line with the LabVIEW programming paradigm
of dataflow, and would make sense to most of our LabVIEW users.
I think your suggestion is interesting, and it does
highlight the need to think outside of the conventional LabVIEW box and look to
some of the innovative things other languages do. However, I think we all agree that
synchronization takes careful planning and extra work for the programmer. Even with an ‘ideal’ solution I see no way
around this. For LabVIEW users today,
one great way to get synchronized ‘by reference’ semantics with your objects is
to use a single-element queue to pass your object. The queue itself is passed ‘by reference’ and
is inherently synchronized! The does
have the disadvantage of adding one more small layer of complexity to your
program, but some complexity would have to be introduced in any situation. The other disadvantage with this is that it
is not always an intuitive way to implement your program and requires some
amount of LabVIEW knowledge before one would generally come across this
technique.
In any case, I appreciate the time and effort you put in to
your suggestion. Please make sure that
you submit the suggestion formally through the NI Product Suggestion Center so
that it can be reviewed by some of the decision makers here.
Thanks again,
Travis M
LabVIEW R&D
National Instruments -
Hi,
Currently studying for SCJP exam and wondering is there a different between the following codes
public class Test extends Thread
static Object obj = new Object();
static int x, y;
public void run()
synchronized(obj)
for(;;)
x++; y++; System.out.println(x+" "+y);
public static void main(String[] args)
new Test().start();
new Test().start();
}and
public class Test extends Thread
Object obj = new Object();
static int x, y;
public void run()
synchronized(obj)
for(;;)
x++; y++; System.out.println(x+" "+y);
public static void main(String[] args)
new Test().start();
new Test().start();
In the first code example, is there a shared object between created threads and the second example, is their still a shared object between threads or is a new object created for each thread?
Cheers!Hi,
In first case, you are acquiring lock on a static object that is of course shared (basic concept) by all instances(of Test). So, for any thread of any instance(of Test) to execute the synchronized block has to wait till any other thread of any other instance(of Test) comes out of synchronized block. It means, all the instances (of Test) are synchronized. In this scenario, you have infinite for loop within synchronized block and you are starting two threads. The thread which enters the synchronized block first will keep on executing and the other thread will never get chance to enter synchronized block.
In second case, as you are acquiring lock on an object, all the threads of a particular instance (of Test) will be synchronized. In this scenario, again you have infinite for loop within synchronized block and you are starting two threads on two different instances. Hence, both the threads will keep on executing in parallel.
I hope, you have already executed both the examples and observed output. And also hope that the above explanation will help you to understand the difference between two scenarios.
Note: Use System.out.println(Thread.currentThread().getName() + " " + x + " " + y); in your synchronized block to track which thread is printing the output.
Thanks,
Mrityunjoy -
Error message when building an application for Labview PDA
When using LabView PDA module to build an application for a PDA target, I receive the following message: "Error building executable. Unable to create file". Why is this happening?
When looking at the error log, it reads "The system cannot find the file specified."
This happens even when looking at one of the Labview PDA example VI's, so it is not a result of the VI containing functions of features not supported by Labview PDA.
When installing Labview PDA, I installed files as follows, and in this order:
(i) Labview 7.1 (installed previously)
(ii) Microsoft eMbedded Visual C++ 4.0
(iii) Microsoft eMbedded Visual C++ 4.0 SP 3.0
(iv) Microsoft SDK for Windows Mobile 2003-based Pocket PCs
(v) Microsoft ActiveSync 3.8
(vi) NI Labview 7.1 PDA module for PocketPC
(vii) DAQmx Base 1.0 for PDA or later
Any ideas?Did you attempt to add the _wordsub.llb and _excelsub.llb files to the application as support files? I believe in LabVIEW 8.0 instead of adding the entire LLBs you should just add the _Word Dynamic VIs.vi and _Excel Dynamic VIs.vi as dynamic VIs. I think I've seen a similar post on the discussion forums in the past that recommended this.
If this suggestion doesn't help, please reply, and attach a simple VI and .lvproj file demonstrating the problem so I can investigate further.
Good luck,
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
How to build a dll for labview pda, which uses the intel ipp primitives in it
Hi all,
For my application, I need to call a c dll from Labview PDA, and in the c function i need to use intel IPP function. When i call my dll, i get an error saying the ippfunction i use, say "ippsCopy_16s missing c or vi file". Can someone tell me what I might be doing wrong?Hi Vani,
When using a DLL in a PDA there are some special considerations you have to take. Please take a look at the following knowledgebase describing the process.
Eli S.
National Instruments
Applications Engineer -
Not sure this is sound programming .. but I offer it up for opinion as it resolved an issue and seemingly works ..
The issue ..
Attempting to provide for "bookmarks" in an app w/ the Shared Object ..
Created the Obj in the maintimeline .. for the life of me I was unable to access the SO from a child MC .. e.g. parent.SharedObject.data. geneated errors
so I created a class object whose properties is the shared object and it worked ..
===== GlobalVars2.as
package{
public class GlobalVars2 {
import flash.net.SharedObject;
public static var UserStatus:SharedObject = SharedObject.getLocal("UserStatus");
===== Parent MC
import GlobalVars2
if (GlobalVars2.UserStatus.data.xml == undefined){ // 1st time here, build shared Object
trace("Doesn't Exist")
GlobalVars2.UserStatus.data.xml = new XML()
GlobalVars2.UserStatus.data.Protocol = ""
GlobalVars2.UserStatus.data.Domain = ""
GlobalVars2.UserStatus.data.Path = ""
GlobalVars2.UserStatus.data.ModFile = ""
GlobalVars2.UserStatus.data.Percent = 0
GlobalVars2.UserStatus.data.Nav_Played = false
GlobalVars2.UserStatus.data.M1_Played = false
GlobalVars2.UserStatus.data.M2_Played = false
GlobalVars2.UserStatus.data.M3_Played = false
GlobalVars2.UserStatus.data.M4_Played = false
GlobalVars2.UserStatus.data.M5_Played = false
GlobalVars2.UserStatus.data.M6_Played = false
GlobalVars2.UserStatus.data.M7_Played = false
SetEnviro() // populate shared object
GlobalVars2.UserStatus.flush()
========== Child MC
GlobalVars2.UserStatus.data.M7_Played = trueFirst of all, I'd recommend to use smpatch utility to update your system. It is available "out of the box" on Solaris 10 and can be installed on Solaris 8 and 9 separately.
If you don't use smpatch, here are some tips for manual patching process:
I can only tell you about first two - libthread and libnsl. They both belong to the same package, SUNWcsl:
$ pkgchk -l -p /usr/lib/libthread.so
Referenced by the following packages:
SUNWcsl
$ pkgchk -l -p /usr/lib/libnsl.so.1
Referenced by the following packages:
SUNWcsl
Current status: installed
Now, to find out which patches are required, use 'showrev -p' command:
$ showrev -p | grep SUNWcsl
Next thing you do is search sunsolve.sun.com for latest versions of patches mentioned by showrev, download them and install with 'patchadd' command. This is rather painful process, so again, I recommend to use 'smpatch'. -
How to create shared object in Open Vms environment.
Hi All,
Iam using Weblogic Server 5.1 on OpenVms 7.2-1. As a part of development, I need
to use JNI(Java Native Interface )to call existing "C" function.
Iam stuck at creating shared object on OpenVms. I would like to know what is the
procedure for creating these shared objects for a given "C" programme.
For your easy reference :This is how we create dynamic link libraries for "C"
code by using Microsoft C++ comipler.
cl -Ic:\jdk\include -Ic:\jdk\include\win32 -LD SampleProgramme.c -FeSampleProgramme.dll
Can somebody help me on this?
Thanks in Advance,
Prashanth Bhat.
You might also want to read the following series of articles:
http://www.oracle.com/technetwork/articles/servers-storage-dev/linkinglibraries-396782.html
Regards,
Darryl. -
Shared Objects and IOS 5.0+
So, I need a straight answer. Can I use Shared Objects for my game, or will apple fail me for using them? Will Shared Objects be backed up with iCloud?
Thanks,
diss.Boat,
From what I have found if your IPA/APK/SWF is the same name then shared objects data should retain.
So if version 1 of your app was
AppleApp.ipa published from a swf by the name of AppleApp.swf
then when you update on your final publish save your swf and .ipa under the same name
Dont do this
First version is
AppleAppV1.swf published out to AppleApp.ipa
Second version is AppleAppV2.swf published out to AppleApp.ipa
The swf is what the shared object is associated with so keep that the same from update to update. -
Shared Object - Prompt Data Permissions Dialog
Hello,
I'm creating a small app to run from CD-Rom/local
installation that will use multiple shared objects for data
storage. To ensure proper saving without surprising the user with a
permissions dialog unexpectedly, I'd like to request unlimited data
storage on first time app launch - Joey Lott shows how to do this
in the Actionscript Cookbook...
request=mySO.flush(1024 * 500);
My question is,
Can I perform this permissions request with the user a single
time with a generic app SO in global fashion, so that the
permissions would be set for any SOs created during the use of the
product (all written to same SO directory), or do I have to request
permissions for each and every SO created? Since the latter
would be unacceptable from a UE standpoint, that means stuffing all
app data into a single SO which doesn't seem so great from a data
config perspective...
I really appreciate your attention and help on this!
Thanks in advance,
-MauraHmm. Experimented a bit and it seems that once the permission
is set it applies to the Flash Player installation globally, and
not per SO, not even per domain...
Or, please correct me if I'm mistaken.
Thanks. -
Shared Object Location Flash Player 11
Where is the location of Shared Objects for Flash Player 11 in Vista?
Thanks for your reply.
I can find those directories as you have suggested but with directory roaming
AppData\Roaming\Adobe.....
AppData\Roaming\Macromedia\Flash Player\#SharedObjects...
In Flash Player 10, it is stored in :
AppData\Roaming\Macromedia\Flash Player\#SharedObjects...
But when I installed Flash Player 11 and went to the site I want data to be stored, it wasn't there (I expected the data to be stored in this directory as it did using Flash player 10) . I am just wondering if Flash Player 10 and 11 use the same folder.
I need to know because I want to make a backup of the data , so that I can manually put them back when installing new flashplayer.
Flash Player 11 erases old data upon installation. -
I just installed JRE 1.4, but it doesn't work:
failed /usr/java/j2re1.4.0/lib/i386/client/libjvm.co, because libstdc++-libc6.1.1.so.2: cannot load shared object file: no such file or directory
When i check:
ls /lib/libc-*
/lib/libc/libc-2.2.2.so
What files should I install to get it work?
Thank you.The best way to explain this problem is JRE 1.4.0 is execting an old shared object for libstdc which had been updated in Redhat 7.2. Since, the functionality in libstdc should still exist in the newer version of libstc I simply made a symbolic link pointing to the current version of libstdc to satisfy JRE 1.4.0.
ln -s /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so /usr/lib/libstdc++-libc6.1-1.so.2Hope this helps.
steve -
How to build sql query for view object at run time
Hi,
I have a LOV on my form that is created from a view object.
View object is read-only and is created from a SQL query.
SQL query consists of few input parameters and table joins.
My scenario is such that if input parameters are passed, i have to join extra tables, otherwise, only one table can fetch the results I need.
Can anyone please suggest, how I can solve this? I want to build the query for view object at run time based on the values passed to input parameters.
Thanks
Srikanth AddankiAs I understand you want to change the query at run time.
If this is what you want, you can use setQuery Method then use executeQuery.
http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#setQuery_java_lang_String_ -
Is there any object in labview that contains a list of data for the user to select (selection one at a time) or add a new data?
List and table controls -> listbox..is that what you are thinking of?
The listbox presents the user with a list of options, and you can set it to only accept one selection at a time...Adding new data to the list can not be done directly by the user but if you make e.g. a text control and a button you can programatically insert new objects described in the text box when the button is pressed...(see example).
If you need more than one column you have the multicolumn listbox. If you want the users to write new entries directly yu can use a table and read selected cells using it's selection start property to read what cell has been selected.
MTO
Attachments:
Listbox_example.vi 34 KB
Maybe you are looking for
-
Function Module to Return MM/DD/YYYY after 6 Months from today's Date
Hi, I need to find out the Month/Date/Year, after 6 months from the given Date. Can any one please suggest me a suitable Function Module to get the MM/DD/YYYY after 6 months from current date. Appreciate your help! Thanks, Kannan.
-
Activity prices maintained manually..Is KSII/MFN1 possible?
Hi Experts, We have this scenario: 1. Activity prices are entered manually in KP26. 2. All Costs are maintained as Activity independent costs. 3. For Production Cost centers, some costs (primary costs) are Activity relevant and others not relevant at
-
Mapping of invoice document type in SRM and Backend
hi, I need to map invoice document type in SRM and backend. We are in SRM5.0. e.g. when we create no PO invoice , we need to select document type from drop down and that document type should be replicated to backend invoice document type. 1. There i
-
WAD-Error configuration.
Hi Gurus, I am presently working on WAD in my sandbox system. Problem: Our's WAD is not configure when i try to save a template I get following error. Portal unavailable or config problem. please contact system admin. Can any one give me hint how to
-
Help needed to deactivate CS 5.5
Hi. I'm in quite desperate need of assistance here. I need to deactivate CS 5.5 from one of my computers in order to activate it on another (2 activations max. and I need it on 2 machines). Problem is that the computer I need to deactivate from is DE