Using mingw to make a .dll for use in labview ?

I have seen some posts on this, but none of them take it all the way from C code to configuring the shared library node...
My code is heavily based on this:
http://forums.ni.com/ni/board/message?board.id=170&thread.id=171056
Here are my files:
//reedll.h
#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT __declspec(dllimport)
#endif
// function to be imported/exported
EXPORT void tstfunc(int A, int B, int C);
and:
//DLL_Test.c
#include "reedll.h"
EXPORT void tstfunc(int A, int B, int C)
  C = A + B;
Its meant to be as bare bones as I can get it. No crazy pointers or anything.
I compile as follows usin MinGW:
g++ -c -DBUILD_DLL DLL_Test.c
g++ -shared -o tst.dll -Wl,--out-implib,libtstdll.a DLL_Test.o
And it appears to compile fine.
When I go to import the .dll into the shared library node the "Function Name" field is garbled and says "Z7tstfunciii" instead of "tstfunc".  Needless to say the shared library function icon that results doesnt work

You should tell the mingw compiler to not name mangle the symbols. Most likely you use a cpp file enxtension and then mingw as Visual C will invoke the cpp compiler instead of c which by default name mangles function names.
If you want or need to use cpp, you can also try to declare your exported symbols like this:
#ifdef __cplusplus
extern "C" {
#endif
EXPORT void tstfunc(int A, int B, int C);
/* all the other function prototypes you do not want to be mangled */
#ifdef __cplusplus
#endif
Not sure if __cplusplus is defined by mingw, if not you have to find how it indicates that C++ mode has been invoked.
Message Edited by rolfk on 03-24-2010 02:48 PM
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • What are the steps to make it seamless for a customer to use the install program and then use the installed program?

    I wrote an install program (.exe) that is downloaded from a website.  When run, it 1) leads a customer to browse to a directory, and 2) copies files (.exe, .dll, etc.) from a website to that directory.  When I run, the installed program works.
    What are the steps to make it seamless for a customer to use the install program and then use the installed program? 
    bhs67

    This site https://msdn.microsoft.com/en-us/library/vstudio/2kt85ked%28v=vs.110%29.aspx provides a basic description of the Visual Studio Windows Installer. 
    Near the bottom of the page is "You can unlock all the features of InstallShield by paying to upgrade to the full version of InstallShield."  Where do I find info that describes the differences between the "free" and the "full"
    versions?
    bhs67
    Hello,
    The default feature does support the task for your requirement, so there is no need to pay for the other features unless you want to use some feature which is not free.
    In addition, as this thread
    InstallShield LE not available with VS 2012 RTM? shared, even through there is a link to InstallShield LE in the New Project dialog under Deployment solutions, but it belongs to third-party that I would recommend you consider posting this issue
    at the following forum to get supports about InstallShield.
    http://community.flexerasoftware.com/forumdisplay.php?133-InstallShield
    Regards.
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Setting up use of a DLL for Multithreading operations.

    Hi all,
    I have been working the past few weeks converting a slow part of our labview code into C++ and hoping that from there I can use CUDA to further optimize and speed up the process.
    I just finished writing everything in C++, and the program works well, but it is already much slower than the old code. This is due to the fact that the old code could multithreading and use up the entire processing power of my processor, while my current code does not seem to want to do this.
    I know that there are many settings from labview to visual studios to even my code itself to allow for mutlithreaded operations, and allow them to happen safely.
    I was wondering if anyone could help me identify these settings so I can move forward with my optimization.
    I will tell you what I have looked at and done so far:
    First I made sure that my program takes all the Array Handles and Numeric values, and assigns them to local variables in my program. I believe this makes my program reentrant safe.
    Then in VC++ 2008, I added some settings to my project settings: Under C++ Optimization, I have Maximize Speed(/O2), enabled intrinsic functions, and favored fast code.
    In code generation, I have my runtime library as Multithreaded debug dll.
    Then in labview, the DLL is nested 2 SubVIs deep. The main VI has no special settings that I am aware of, but the first SubVI is set to time critical priority, and reentrant execution, while the final subVI which holds my DLL is set to subroutine, and reentrant execution.
    FInally my DLL has run in any thread selected, and debugging turned off.
    Am I doing this correctly? Are there parts missing in my program that I need to write to allow for this sort of functionality?
    Thanks!

    Deturbanator wrote:
    Thank you for your reply.
    I assign parameters to local variables for exactly the problem you described, shared resources. For example, this program in particular works on a video file, and completes a process on a frame by frame image. I assume that if I do not copy the values to a local variable, the array handle for the image will change between different instances of the program, and this might be bad if we are at first analyzing frame 3, and then suddenly, it changes to frame 5.
    Is this not something I should be concerned with, does labview take care of this already? It seems there is a lot of magic happening behind the walls and options of labview
    And I agree, Labview is quite good, and I did not expect a big boost from converting my code to C++. However I see no reason it should be any slower than the existing labview code, if most of the functionality is just rewritten in C++. The real reason for the code conversion, was to eventually write certain parts in CUDA, which I felt would be easiest once the code is in C++.
    I guess my real question is what are the "hoops and rings" i need to jump through to match the labview efficiency?
    thank again!
    It's still not clear to me what you expect by the use of local varaibles in terms of parallel execution. Or maybe you are not talking about function local variables but module local variables outside the function???? If that is the case, then you have probably totally misunderstood the fundamentals of multithreading safe code.
    When LabVIEW calls a function through the Call Library Node, it will make sure that all the parameters passed to that function stay valid for the duration of the call. Once the function returns to the LabVIEW diagram LabVIEW considers it safe to do with the buffers as it likes, including moving them in memory, resizing them, reusing them for other stuff, or simply deallocating them. So saving such a parameter to a function local variable makes no difference, since the function local variable will exist just as long as the parameter is guranteed to be valid. And saving it to a module local variable is either creating a pretty sure race condition or even crash, if you just save the reference, since the buffer the reference is pointing to will not be guranteed to stay valid after the function returns. And if you save it to a local variable by copying its contents it will be safe, but a performance problem, as you create a copy of the data.
    So what are you really doing here? Some example code could certainly help to understand what you are doing, as I have a hunch that what you call a local variable is in fact more a global variable although you may declare it as static and make it in that way local to your code module (but still global to all functions in that module).
    Generally if you want your C code to process data asynchronously however (meaning working on it after the function returns control to LabVIEW, then you can't avoid to copy the buffers.
    As to the hoops and rings to jump through there is no simple explanation. In fact there have been entire books written about multithreading, and more importantly correct multiprocessor programming.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Error when compiling my API Programm thant i want to generate DLL for use in Labview!

    Pls see the attachment!!I use API "GetComputerName" to programm in vc6.0 to make a dll file for use in Labview.But i get the error in the attachment. Pls give me a hand!
    Attachments:
    machinename.zip ‏1493 KB
    error_when_compiling.txt ‏1 KB

    Hi,
    If you are using the CVI libraries on this you can use the GetCompName() function from the programmer's toolbox. However, your code looks fine, the only thing that you need to change is the data type of the paramenters in CompNameLength. Just declare them using the predefined Windows data types; like this:
    LPTSTR computerName;
    DWORD compNameLength = MAX_COMPUTERNAME_LENGTH+1;
    computerName = malloc(MAX_COMPUTERNAME_LENGTH+1);
    GetComputerName(computerName,&compNameLength);
    printf("%s",computerName);
    free(computerName);
    Don't forget to include windows.h where those types are defined.
    Good Luck!
    Juan Carlos
    N.I.

  • How can someone use a stolen iphone? does erasing the phone (which I feel like I should do) make it easier for the thief to use the iphone?  If I don't erase it, it doesn't seem like anyone should be able to use the phone because of my password.

    how can someone use a stolen iphone? does erasing the phone (which I feel like I should do) make it easier for the thief to use the iphone?  If I don't erase it, it doesn't seem like anyone should be able to use the phone because of my password. Also, is it possible to retrieve anything that has been sent to the phone (i.e. text messages) since it was stolen through icloud? The "find my iphone" app says the device is offline but it rings when I call my number -- any idea how that would be the case? Thanks!!

    You have a password, so good move on your part.  Whether you erase it or the thief does, they still get to use the iPhone as theirs.  Which is more important (pick one), protecting your data or punishing the thief?
    Ringing occurs at the carrier.  Chances are you're going to voicemail after only two or three rings.  If you have an iCloud backup also a good move.  Re-read my question in the first paragraph.

  • I have to make a catalouge for my services as a financial planner.. earlier i used to do in MS publisher.. now i have a mac book.. can some one help me with some software info with which i can design a catalogue??

    I have to make a catalouge for my services as a financial planner.. earlier i used to do in MS publisher.. now i have a mac book.. can some one help me with some software info with which i can design a catalogue??

    Depending on what your needs are, you may use Pages included in iWork or purchase it separately (usually there is an evaluation copy with any new mac, I guess) or try other publishing apps. I once used MS Publisher, I remember it was something like a more sophisticated word processor, right?
    You may try the cheaper DTP iCalamus or Word for mac.

  • I use yahoo for my email. I would like to make a folder for an email.  How do I do this.

    I use yahoo for my emails.  I would like to make a folder for an email.  How do I do this?

    If you go to your email account in the Mail app and look at the window where your inbox, trash folder and sent folder are - if there is an Edit button at the top of the window - tap that and then tap Add Mailbox at the bottom.
    If the Edit button is not there - you cannot create folders on the iPad. Your email account is not IMAP. Only IMAP email accounts can create folders on the iPad. Any folders that you would already have in an IMAP account would sync to the device as well.

  • TS2755 When will Apple ever make it convenient for the customer, I just bought an iPad Air and I'm very upset that I can only use iMessage, iPads are the biggest mistake to buy. I'll never buy another if I can text using SMS or MMS

    When will Apple ever make it convenient for the customer, I just bought an iPad Air and I'm very upset that I can only use iMessage, iPads are the biggest mistake to buy if you like texting family and friends. I'll never buy another one if I can't text using SMS or MMS.  Is there any hope for a patch or new operating system to fix this issue, or an app to use with iPad Air

    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    How to Receive SMS Messages on an iPad
    http://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.html
    Apps for Texting http://appadvice.com/appguides/show/apps-for-texting
     Cheers, Tom

  • How to make S-Curve for Primavear P6 by using BI publisher?

    Hi,
    Anyone knows how to make S-Curve for Primavear P6 by using BI publisher? I can display colunm such as planned unit, but not cumulative value. So I can't plot S-curve.
    Thanks
    Wang Xin
    Edited by: 957906 on 09-Sep-2012 03:26

    The problem with the datagridview is that it can only show one table.
    For more tables 3th party datagrid's are better. 
    Although you can start with using the old datagrid. Despite what is written on MSDN is it a complete different control then the datagridview. You can add in to your toolbox by right clicking on it and then add it.
    The datasource of a DataGrid can be a complete dataset which is showed with all its relations.
    Success
    Cor

  • I would like convert a c++ dll for use in labview--my device has no labview dll

    I have a piezoelectric control board (Piezomechanik gmbh) that I would like to use through LabView.  Currently, the company does not offer any support for Labview.  Windows sees the device (It came with a driver file), but the company only provides dll files for C++ and Visual Basic.  Can I convert these files to a format Labview can use?  How can I get Labview to communicate with the control board (and ultimately the piezoelectric device attached to it)?  Thanks!
    Solved!
    Go to Solution.

    This will only help you when you have the header file for the DLL, otherwise you will have to create the wrapper manually using the "Call library node" and the DLL api description or write an header file for the DLL yourself based on the api documentation and use the wizard.
    Regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Q: Must one use special LabVIEW types (e.g. float64) for DLLs in LabWINDOWS/CVI?

    Hello,
    I have recently started compiling C code using LabWindows/CVI, and have successfully called a simple DLL function from within LabVIEW.
    I have a question about the types defined in LabVIEW's extcode.h file:
    These are defined to explicitly quantify the number of bits used for each data type (e.g. float64 instead of float) in order to eliminate ambiguity across compilers.
    When I am using LabWindows/CVI to compile, do I need to use the LabView numeric types defined in LabView's extcode.h, or can I use the standard C types (int, float, etc.)?
    Is there a distinction between having to use these special types for CIN versus shared library calls in LabVIEW?
    Thanks
    in advance,
    Frenk

    You do not have to use the defines in extcode.h, but you certainly can if you want to.
    The float64 is equivalent to CVI's "double", and the float32 is equivalent to CVI's "float".
    These correspond to the double- and single-precision types in the IEEE Standard for Floating Point Arithmetic, IEEE-754.
    I hope this helps.
    Brian

  • How to make a program for backgroung processing used servlet

    how to make a program for backgroung processing used servlet

    well i need the coding part written in servlet ,in which servlet is always ready for accepting a client request.

  • When I try to record narration in keynote on my imac I cannot escape out of this screen.  I have to force quit out of keynote.  This makes it impossible for me to use.

    When I try to record narration in keynote on my imac I cannot escape out of this screen.  I have to force quit out of keynote.  This makes it impossible for me to use.

    Click the record button to stop recording.

  • I m asked to put credit card details whenever I try to make an applied for my iPad4. I donot use credit cards or other plastic money. Can't I make an id without it?

    I m asked to put credit card details whenever I try to make an applied for my iPad4. I donot use credit cards or other plastic money. Can't I make an id without it?

    follow this Creating an iTunes Store account without credit card - Support - Apple

  • Using NISPY DLLs for VxiPlug&Play driver development

    Using NISPY DLLs for VxiPlug&Play driver development.
    I am developing and testing VXI Plug&Play drivers. I am testing the error conditions and need to verify the drivers do not send SCPI when invalid parameters are sent. I would like to use the NISPY dlls so that I can verify this automatically, without the tester having to monitor NISPY. Is there a way to do this?

    We are writing IVI drivers now, I wonder how can we get this test utility
    (for IVI
    driver testing for compliance with the spec) from your place.
    chen ning
    Easbeacon Test Systems Co.
    "Dan Mondrik" wrote in message
    news:[email protected]..
    > I assume that what you are trying to do is to ensure that no VISA I/O
    > calls get made when your driver has an invalid parameter. Using NI
    > Spy will show you what calls are made, as you know.
    >
    > What you might want to do is to configure NI Spy to start up with
    > capture enabled and have it log to a file; then you can visually
    > inspect the log file later. However, take note that the log file will
    > get huge quickly.
    >
    > Another option might be to manually disconnect the device
    (eg, the MXI
    > cable)after viOpen; this assumes that you are doing all your invalid
    > parameter testing at one point in time but it may not work for all
    > buses.
    >
    > If you are writing an IVI driver, we do have a test utility for IVI
    > driver testing for compliance with the spec, and for some other
    > structural tests.
    >
    > Dan Mondrik
    > Senior Software Engineer, NI-VISA
    > National Instruments

Maybe you are looking for

  • Copying Titles

    I've selected the font, font size, text color and background color for captions. Is there a way that I can copy these preferences and paste them onto other clips so that all I have to do is change the words in the caption for the new clips? Or do I h

  • E71 signal hampered by holding the phone??????

    I have an E71 on O2, and the signal is massively affected by whether I am holding the phone or not!!!! There is only one part of the house I can get 3G (close against my office window), and the rest of the house, especially downstairs I get a 1-3 bar

  • Itunes set up

    i hope somebody could help me with my problem regarding itunes set up. after reinstalling my itunes there is no set up which will automatically transfer my music files from my pc to itunes.What happened after i reinstalled is that the itunes just ope

  • Clipboard Management in Adobe Illustrator Draw

    How do I erase items from the clipboard in the Adobe Illustrator Draw app?  While learning the app functions I created a couple of junk images on the clipboard and it appears there is now no way to erase them.  I tap the scissors icon and nothing hap

  • HT3702 why cannot i not go into my app store and update my stuff u have debited my  cc twice and it still askes for me to update and will not let me

    why is it that i cannot update my games and such on my cell phone my credit card has been charged twice so i would like to have my money put back on my card