LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Library and DLL in C

Hi there,
I am currently writing a shared library to do some specific image
processing. This is very application based library and is currently only
designed for one application. The problem i have is that i am very new to
the world of Mac OS X. I have my code to compile in Win32 a DLL that
exports the functions that i need access to. The problem is that all the
documentation and help i have found, has so far not lead me to compiling
even the simpliest shared library in Mac OS X. I can compile and run the
samples that come with CodeWarrior IDE version 5.0, and run the test
applications it produces as well. These work all fine, but I still can not
get access to any of the export functions from labview. Guided help or
advice on what type
of project to use, etc would be greatly appreciated.

Thanks in advance,

Carl Pattie


pattiec2 at lincoln dot ac dot nz
0 Kudos
Message 1 of 8
(3,878 Views)

Hello Carl,

It looks like you are having trouble writing DLL files using LabVIEW on Mac OS X. I believe they now call them frameworks under OS X. First, let�s make sure you have the necessary software. I�m assuming you already have the >LabVIEW Application Builder for Mac OS.

Under Mac OS 9, you needed to download MPW (Macintosh Programmer�s Workshop) in order to write dll�s in LabVIEW. The OS X version of this is called the Project Builder.

This [broken link removed] tutorial is made for Windows, but it should be almost identical for a Mac. I just tested making a dll file on Mac OS X, and it seemed
very similar to the process on Windows.

Let me know how far these suggestions get you, and if you need additional help, I�ll be happy to look further into it.

Have a nice day!

Robert M
Applications Engineer
National Instruments

Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,878 Views)
Hello Carl,

Thank you for contacting National Instruments.

If I understand your situation correctly, you are trying to create the equivalent of a LabVIEW DLL in Mac OS X.

In the Mac OS world, a shared library is known as a Code Fragment. In order to create a Code Fragment in Mac OS X, you will need to use a Mac version of LabVIEW that includes the Mac OS Application Builder.
You can convert the VI(s) you have created in Windows to Mac and then rebuild your stand-alone application.

Once you have rebuilt the application in the Mac environment, ensure that you have the LabVIEW runtime engine installed on any Mac machine that you are trying to call the Code Fragment (Mac DLL) on. Also be aware that to use the Build DLL functionality on the Macintosh, you
must have a full installation of Apple MPW (Macintosh Programmer's Workshop), including ToolServer, on the computer. You can download Apple MPW at www.apple.com/developer. It is not sufficient to have an installation of the Code Warrior MPW. It does not include the necessary set of tools.

I hope this helps! Let me know if you have further questions.

Matthew C
Applications Engineer
National Instruments
0 Kudos
Message 3 of 8
(3,878 Views)

Thanks Robert,

Unfortunately i think i painted the wrong picture in the earlier message.
I am infact writing the DLL and shared library in C. I have all the code
and it compiles on both the Mac OS X using Code Warrior and Visual Studio 6
on the PC. The PC version i can access and see the exported symbols /
functions, but on the Mac i can not. Even building some of the sample
shared librarys leaves me with no exported functions to call from labview.
I have tried using the ".exp" file, and also the "#pragma export on ...etc"
but this just changed nothing.
I suppose the essents of this question is how exactly does LabView expect
the functions to be exported. And what language or "stationery" is the best
choice in CodeWarrior / Apple X Code.
I did find examples of the CIN projects, so i think i will try and modify
one and see how that compiles and if Labview can see the exported functions.

Thanks,

Carl Pattie


"Robert M" wrote in message
news:50650000000500000098620100-1077587809000@exchange.ni.com...
Hello Carl,

It looks like you are having trouble writing DLL files using LabVIEW
on Mac OS X. I believe they now call them frameworks under OS X.
First, let's make sure you have the necessary software. I'm assuming
you already have the http://sine.ni.com/apps/we/nioc.vp?cid=10732〈=US
>LabVIEW Application Builder for Mac OS .

Under Mac OS 9, you needed to download MPW (Macintosh Programmer's
Workshop) in order to write dll's in LabVIEW. The OS X version of
this is called the Project Builder.


This tutorial is made for Windows, but it should be almost identical
for a Mac. I just tested making a dll file on Mac OS X, and it seemed
very similar to the process on Windows.

Let me know how far these suggestions get you, and if you need
additional help, I'll be happy to look further into it.

Have a nice day!

Robert M
Applications Engineer
National Instruments

0 Kudos
Message 4 of 8
(3,878 Views)
Carl,

Have you double checked that you have Project Builder installed? Code Warrior is not enough, LabVIEW requires the Project Builder. After building the framework on OS X and trying to access the function, I ran into what may be a similar problem. Where I should have had a pull-down menu of functions within the framework, the button was blurred out. I had to manually type in the function call name. This may be what you are running into as well. Let me know if either of these suggestions help, and we'll look into it further. Thanks, and have a great day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 5 of 8
(3,878 Views)
Thanks Robert,
I had the same problem with the pull down menu. It was blurred out,
although typing in the name of the exported function did not help as, well.
I don't think Project Builder is installed, i will check this and see if
that helps. I suppose using the template for the a CIN in project builder
is the way to go, but remove the CIN run function and replace it with the
functions that i want to export.

Cheers for the reply,
Carl
0 Kudos
Message 6 of 8
(3,878 Views)
I forgot to mention that I do have XCode installed. Under Developer > etc.
Is this the same? Or do I need an older Project Builder?


"Carl Pattie" wrote in message
news:cDw1c.1333$Nc3.22489@news.xtra.co.nz...
> Thanks Robert,
> I had the same problem with the pull down menu. It was blurred out,
> although typing in the name of the exported function did not help as,
well.
> I don't think Project Builder is installed, i will check this and see if
> that helps. I suppose using the template for the a CIN in project builder
> is the way to go, but remove the CIN run function and replace it with the
> functions that i want to export.
>
> Cheers for the reply,
> Carl
>
>
0 Kudos
Message 7 of 8
(3,878 Views)
Carl,

Here are a few more suggestions/tips to try/look into.

According to Apple, XCode is the newer version of Project Builder, so you should be ok there, but it does require some configuration when switching from CodeWarrior (see bottom of the XCode article).

Even though Apple supposedly provides an API for unloading the executable of a framework, the API doesn't do anything (and they freely admit this). Until they make their API do what it says we can not unload the executable of a framework at will.

XCode looks in /Library/Application Support/Apple/Developer Tools/Project Templates/ for the templates for its projects. So the LabVIEW Templates folder fro
m the LabVIEW/cintools/Project Builder Files directory needs to be put there, not into the Project Templates folder in the /Developer/ProjectBuilder Extras directory.

Even though the pull-down menu doesn�t provide the function names, you should still be able to type them in manually and have them work. What happens when you try this?

Have a nice day!

Robert M
Applications Engineer
National Instruments
Robert Mortensen
Software Engineer
National Instruments
Message 8 of 8
(3,878 Views)