--3643137.1082680681924.JavaMail.quiq.tekken
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I'm not sure if it will help or not, but I have attached the detailed
instructions I wrote up when wrestling with this last year.
I needed C++ in a DLL (not CIN), and detailed the steps to get there.

If CINRun is unresolved, you're not including the library in the
library list.
--3643137.1082680681924.JavaMail.quiq.tekken
Content-Type: text/plain; name=Compile_Notes.txt
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=Compile_Notes.txt
Content-Description: Compile Notes

HOW THE DLL "XX.dll" WAS BUILT:

1... In Visual C++ 6.0, select File | New | Projects | Win32 DLL. Give it a name, 
choose a location, select CREATE NEW WORKSPACE, and then OK.  On the next page, select 
CREATE EMPTY DLL.

   --- this creates a folder with a skeleton project in it.

2... In LabVIEW, create a VI with the inputs and outputs corresponding to the DLL's 
inputs and outputs. Put a CALL LIBRARY function on the diagram.

3... Pop up on the CALL LIBRARY node and select CONFIGURE to get a dialog box. Leave 
the LIBRARY NAME field blank for now. Enter a function name and select C as the 
calling convention.

4... Change the words "return type" to "error", or some descriptive name.  Set the 
TYPE selector to NUMERIC, and the DATA TYPE selector to SIGNED 32-BIT INTEGER.  This 
establishes the return type of your C function (in the DLL).

5... Add parameters, set their TYPES and DATA TYPES and pass BY VALUE or BY REFERENCE 
as needed.  For XX, I chose:
errorCode       Numeric         Signed 32-bit integer
MachineName     String          String Handle
ProgramName     String          String Handle
ErrorMessage    String          String Handle
ChannelTags     Adapt To Type   Handles By Value

6... Check the FUNCTION PROTOTYPE field to verify it looks correct.

7... Click OK, and the CALL LIBRARY node changes to match your settings.

8... Wire the inputs and outputs to the CALL LIBRARY node.

9... Save the VI in the project directory.

10.. Pop up on the CALL LIBRARY node, and choose CREATE C FILE.  Change the extension 
to .CPP if needed, and save the file in the project directory.  Quit LabVIEW if you 
want.

11.. Open the DSW file in Visual C++.

12.. Select PROJECT - ADD FILES - and add the C (or CPP file) you just created.

13.. Select PROJECT - ADD FILES - and add LABVIEW.LIB (from the LabVIEW CINTOOLS 
folder), if you need manager functions.

14.. Choose PROJECT - SETTINGS - ALL CONFIGURATIONS - C++ - PREPROCESSOR and enter the 
full path to the CINTOOLS directory in the ADDITIONAL INCLUDE DIRECTORIES field.

15..  Choose PROJECT - SETTINGS - ALL CONFIGURATIONS - CODE GEN and select STRUCT 
ALIGNMENT = 1 BYTE

16..  Choose PROJECT - SETTINGS - DEBUG CONFIGURATION - choose DEBUG MULTITHREADED DLL 
in the USE RUNTIME LIBRARY selector. If you use DCOM (OLE between machines), enter the 
following after the last /D entry in PROJECT OPTIONS: |/D "_WIN32_DCOM" |   (not 
including the | marks)

17..  Choose PROJECT - SETTINGS - RELEASE CONFIGURATION - choose MULTITHREADED DLL in 
the USE RUNTIME LIBRARY selector. If you use DCOM (OLE between machines), enter the 
following after the last /D entry in PROJECT OPTIONS: |/D "_WIN32_DCOM" |   (not 
including the | marks)


18.. Open the C (or CPP) file in Visual C++. If you're using C++, put the text |extern 
"C" {| just before the declaration of your function, and the text |}| immediately 
after it.  (not including the | marks)

19.. Put the text |_declspec(dllexport)| immediately before both the declaration and 
the definition of the function.  (not including the | marks)

20.. Erase the line YOUR CODE GOES HERE, and enter your code.

21.. Build the DLL.  Set the BUILD - ACTIVE CONFIGURATION to RELEASE and use the DLL 
in the RELEASE folder once all bugs are fixed.

22.. Open the VI again in LabVIEW and pop up on the CALL LIBRARY node to select 
CONFIGURE. Enter the file name of the DLL in the LIBRARY NAME field, or BROWSE to the 
version in the DEBUG (release) folder.

23.. Run the VI.

24.. The DLL is loaded when the VI is loaded, and unloaded when the VI is unloaded.  
If you go back to C to make revisions, close the VI before rebuilding, or you'll get a 
CAN'T WRITE TO XX.DLL FILE error.
--3643137.1082680681924.JavaMail.quiq.tekken--


Reply via email to