Calling DLL

Hello,
I am trying calling a DLL in LabVIEW.
I do get all the desired results.
But then if i run it for the second time it gives an error which is as
follows
"The instruction at '0x0622277d2' referenced memory at `0x00000000'.
The memory could not be read"
Can Anyone please tell me what is this error and how it can be
rectified.
Avni

There are many possibilities here, but they basically all deal with improper use of memory. Basically, you're stomping in a part of memory where you shouldn't be. This could be due to improper memory management when you're passing parameters to the DLL. What kind of data are you passing? Just numbers, or arrays? How about strings? It could also be the DLL itself. Without more information...
You may want to check the examples that ship with LabVIEW on how to properly interface to DLLs. There's an excellent example that covers a multitude of datatypes. You should also check the NI Knowledgebase.

Similar Messages

  • The problem about call dll from VB....

    Dear All.
    I have a device and  VB dll file.I want to use labview to call  dll.But Labview show "An Exception occurred within the external code ..."
    Below is  to call this dll details.
    1、FindHardware:
    Call it at beginning when load program first, it can let program auto detect printer port address and model of dso scope.
    parament
    winversion:
    winversion = 2  "Windows NT,XP"
    UIP: open UIP(2048) array
    UCP:open  UCP(1023, 1023 + 11, 6)  array
    return:
    board_model:
    dso2902_128 = 27
    Then is my program
    Could somebody tell me what's wrong?
    Attachment file is this dll.
    http://us.f1.yahoofs.com/bc/500cf3ac/bc/dll/dll.ra​r?bfd1QSDBkHPgKI9c
    Thanks.
    由 Samyang 在 10-09-2005 07:14 AM 上編輯的訊息

    I can't say I understand the documentation snippet you provides, and I also can't access the DLL, but here are a couple things...
    1. I doubt very highly that a VB DLL is built with the C calling convension. I believe you should try the stdcall instead.
    2. You have the winversion being passed by pointer, but the docs make it look like a regular integer. Is that correct?
    3. Your board model is being passed by value, but it is listed as a return value in the docs. That would indicate an actual return value or a parameter passed by reference.
    My guess is that one or more of the above is causing the stack to get corrupted or an invalid pointer to be accessed and that is generating the error. Is there anyway to see the document (pdf or webpage)?
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • Application crashes when calling DLL built with LabVIEW 2011

    Hello everybody,
    Our application calls DLLs built with LabVIEW 2010 SP1. We installed LabVIEW 2011 and built some DLLs. So far so good. If we start our application and run 2010 DLLs it still works fine. If we run a 2011 DLL just once no error happens, but if we try to run the same 2011 DLL our application crashes reporting the error below. I saved the code for 2010 version and built a DLL and it works fine. Does anyone know why?
    Thank you in advance.
    #Date: Fr, 16. Sep 2011 16:25:25
    #OSName: Microsoft Windows XP Service Pack 3
    #OSVers: 5.1
    #OSBuild: 2600
    #AppName: PasTA
    #Version: 11.0f2 32-bit
    #AppKind: AppLib
    #LabVIEW Base Address: 0x30000000
    16.09.2011 16:25:26.181
    Crash 0x0: Crash caught by NIER
    File Unknown(0) : Crash: Crash caught by NIER
    minidump id: 8a779b3f-51d7-4864-8e4d-6ab0195cd158
    ExceptionCode: 0xC0000005
    N
    0x3072C804 - lvrt <unknown> + 0
    0x3072CBB8 - lvrt <unknown> + 0
    0x7C864191 - KERNEL32 <unknown> + 0
    0x7C83AB50 - KERNEL32 <unknown> + 0
    0x00000000 - PasTA <unknown> + 0
    Attachments:
    error.PNG ‏11 KB

    On that note, you should be able to create DLLs in 2010 and run them with 2011, correct??  In my case, I have a 2010 built DLL (talking to sbRIO), most of the functions work when run in 2011, but a couple of them lock up LabVIEW on the desktop (but not the sbRIO), no lock ups happen with 2010 on the desktop.

  • Call dll in labview

    "Hi All,
    I have to get data from USB camera, I have following functions in DLL.
    DLLINOUT HANDLE WINAPI CC_Open( LPCSTR CameraName , ULONG CameraNumber , CC_CAPTURE_MODE CaptureMode ) ;
    and
    DLLINOUT BOOL WINAPI CC_CaptureSingle( HANDLE Cam , PVOID Buffer , ULONG TransferSize , CC_TRIGGER_MODE TriggerMode , USHORT TimeOut , OVERLAPPED * pUserOverlapped );
    When I open hardware with function cc_open I am getting handle to an object. How can I store this object and pass it to CC_CaptureSingle function?
    Another question is when I call CC_CaptureSingle I am getting pointer on the 2 dimension array �PVOID buffer� how can I get this array in Labview?"

    hi,
    you can do this two thing.
    1. Create your new DLL with (your DLL will call camera's DLL) one big function my_capture_image() and insert you do CC_Open(), CC_CapruteSingle() and CC_Close(). And to LabView you pass only Array whit image data. And you don't have problems with HANDLE. But you must allocate memory for image array in LabVIEW before you call this DLL!!! [Or use LabVIEW C function for reallocating memory]
    2. You must identify type of HANDEL variable. And you can change type of this variabile. But when HANDLE variable is structure it is hard pass this structure to LabVIEW.
    If you use LabVIEW 7.1 look example 'Call DLL.vi' it is great!
    Have a nice day.
    JCC

  • "HOW to use Labview call Dll compiled by VC++"

    "hello,I use VC++ compile a DLL,and i want to call DLL Function in LABVIEW program.But there is a dll function
    when i call it in labview.There is error.The prototype of Dll Function that make error is "USHORT DLLFUN __stdcall IBWRT(unsigned short dev_address,const char *pstrWrite)",The second paramenter is a char pointer,
    and the paramenter pass a command which content is
    "MEASURE:CURRENTC? 1A,0.001MA".
    When i use VC++ to call this function,i program followed:
    CString m_wrt;
    int ReturnW;
    m_wrt="MEASURE:CURRENTC? 1A,0.001MA";
    char buffer[40];
    strcpy(buffer,m_wrt);
    ReturnW=IBWRT(4,buffer);
    and this call is correct.
    But when i use labview to call this function.ther
    e is
    error.So, who can help me,to tell me how to call this
    function.Thanks."

    Are you asking about porting code or calling C++ code in LabVIEW?  As far as porting code, there's no easy way to move code back and forth between LabVIEW and C++.  However, if you are trying to call C++ code in LabVIEW, you can compile it as a DLL and call it in LabVIEW using the Call Library Function node.
    Chad B. » National Instruments » ni.com

  • Calling  dll method from oracle forms

    Hi,
    This is my first post in this forum. I don't know whether this is the right place to post this topic here.
    i wana call DLL method from the button click event of my form.
    I new to oracle development any help will be greatly appreciated.

    Calling DLL using form 6i
    Regards,

  • Calling Dlls from LabVIEW

    LabVIEW Gurus:
    I am working with some software engineers who have no experience in LabVIEW. Unfortunately I have little experience in C/C++ to make sense of their inquiry.  
    Basically we are dealing with “Data Marshalling”. I will call a DLL and issue a command (string) and get back a 2-D array and an integer. So far so good.
    The C/C++ programmer requested that I provide them with a pointer/memory address in which they will store data, so I can read it once the dll returns the array and integer. I browsed through the example online http://decibel.ni.com/content/docs/DOC-1690 and thought that if I wanted to read from the dll, the process is a simple as calling the appropriate function and configure the parameter (no pointers needed).
    So, is there a specific way that they need to write the C/C++ code to be used in LabVIEW? Or what else to I have to take into consideration?
    Thank you,
    Santiago 

    That example is pretty simplistic as it only deals with integers. In this case no pointers are required since everything is returned by value. When you're dealing with arrays, however, you need to deal with pointers. If you open the Example Finder (Help -> Find Examples) and search for "dll" you will see the "Call DLL" example. That contains many examples of how to call DLL functions with a wide variety of datatypes. I strongly suggest looking at that example. There is also a chapter in the LabVIEW Help on calling DLLs (Fundamentals -> Calling Code Written in Text-Based Progamming Language).
    You have 2 things to consider:
    You're dealing with arrays - this means you typically need to pre-allocate the memory in LabVIEW, and it sounds like that's what the DLL expects you to do. This amounts to using the Initialize Array function to create your 2D array of the appropriate size and datatype.
    You may be dealing with a C++ DLL. LabVIEW can only interface to C DLLs. This doesn't mean that you can't create a DLL in C++, but it does mean that the C++ programmers need to add an extern "C" modifier to the function calls, otherwise you get name mangling, and LabVIEW won't be able to call the DLL. The DLL programmers should know what that means.

  • I want to call DLLs generated in LAbWindows CVI in Borland C++ (BCB 6)

    Hi,
    I want to call DLLs generated in LabWindows CVI in Borland C++, I am using BCB 6 and LabWindows CVI 8.
    I am able to call these functions in VC++, But getting following error in BCB
    ":[Linker Error] 'D:\GAJANAN\CVIDLL.LIB' contains invalid OMF record, type 0x21 (possibly COFF)"
    Please somebody suggest me how to solve this problem.
    Thanks and Regards
    Gajanan

    Duplicate post.

  • Can we call DLL method in jave code

    hi,
    can we call DLL file method in java Code or program.

    See
    http://forum.java.sun.com/thread.jsp?forum=52&thread=179765

  • Is it possible to call dll-functions with records/types as arguments?

    or must I use the fixed preselection of types

    LabVIEW must call DLLs with data types it is compatible. Therefore, you must use the types available through LabVIEW.
    I have two pieces of advice on this matter:
    First, contact NI and get their advice on how to call your data type. They may be able to offer a very quick solution.
    Second, if you cannot call these data types, and you have a compiler, I would suggest "wrapping" the DLL inside another, and 'translate' the data type from something LabVIEW can handle, to the type needed by your DLL in this 'wrapper' DLL.

  • Do i have to use .h files to call .dll files?

    Dear,
    Now i want to use labview to control an instrument. And the instrument company give their dll files.
    When i use tools---> import---->share library,labview tells me import .h file,but their are many .h files,you know you can just choose only one head files in labview at the same time.So should i write a new .h file to concluding this head files and every thing will be ok?it is complicated.
    I use another method to call .dll and it is CIF.But i also encounter new problem.When i invoke the node .dll,and then choose the functions,i find that the functions are void.Does It meanthat i can not input my parameter,and get output?
    So what' the problems?
    Thanks.

    To call a dll in LV, you have to use the Call Library Fuction node in your BD. Then dbl-click it to open the Configuration dialog. In that, you have to browse to the appropriate folder in teh Function tab & select the dll you want to call. Then select the function from the list populated down to it. Then go to the Parameters tab & select/assign the parameters for that function. This will do the job.
    - Partha
    LabVIEW - Wires that catch bugs!

  • 1097 error calling DLL

    Hi,
    I am a student currently doing an internship, and I may need some help. First of all, I am a beginner with LabVIEW, so maybe what I am asking is silly but I am completly lost.
    In my project, I have to command a CD/DVD reader manually (speed of rotation, data transmitted...), and for this I am using a free DLL file I find download on this website.
    http://www.frogaspi.org/
    So I do not have access to the source code, just to the header file and the DLL. When I am calling it, I get the error number 1097.
    As I understand in several posts on this forum, the reason is probably that the buffer used by the Call Library Node is not correctly sized. Indeed, the parameter is a pointer to a cluster that contains numbers and strings. But how exactly can I do a allocation of memory on Labview?
    Also, I understand that writting a C++ wrapper could be a solution, but can I do that whithout the source code? (I only know a little bit about C and not about C++, but I understand that both are similar so I hope I will manage to do it if you think it is possible. Still if it is, could anybody send me some documentation about it).
    If anybody could have any idea that would be useful or at least could advise me some documentations, I would me more than grateful.
    The header file and the DLL files are available on the link I post (it is not my work so I am a little uncomfortable posting it here)
    Thanks a millions,

    Hi,
    First of all, thanks for your answer. Sorry for answering just now, but I was trying to advance by my own too, and also I was asked to work on other things in my internship. I will try to explain you what I have done so far.
    Thanks for explaining me the difference between an API and an ASPI, I have to recognize that I did not get the difference between both before you told me, and that makes everythink clearer to me now. Still, the "dll" I find on this website seems to be a ASPI Manager, and they say
    "The ASPI Manager for the SCSI host adapter processes these function calls and generates the appropriate SCSI commands to the SCSI peripherals".
    So, maybe I misunderstand that again, but it seems to me that the first step you recommend to do is already done by the creater of this DLL.
    Also, I am now using Labview 2011 instead of 2010, but I don't think this change a lot in my problem. I send the labview code I made, it is currently very basic but if I cannot access the basic function of the DLL, there is just no point trying to make a code more complicated. I am for now just trying to call one of the function of the DLL and see what is happening.
    For this first function, the parameter to send to the node is a pointer on this structure:
    typedef struct
    BYTE SRB_Cmd;                 // ASPI command code = SC_HA_INQUIRY
    BYTE SRB_Status;              // ASPI command status byte
    BYTE SRB_HaId;                 // ASPI host adapter number
    BYTE SRB_Flags;               // Reserved, MUST = 0
    DWORD SRB_Hdr_Rsvd;     // Reserved, MUST = 0
    BYTE HA_Count;                // Number of host adapters present
    BYTE HA_SCSI_ID;            // SCSI ID of host adapter
    BYTE HA_ManagerId[16];    // String describing the manager
    BYTE HA_Identifier[16];      // String describing the host adapter
    BYTE HA_Unique[16];         // Host Adapter Unique parameters
    WORD HA_Rsvd1;             // Reserved, MUST = 0
    SRB_HAInquiry, *PSRB_HAInquiry;
    It is not really working so as I read on this NI webpage: http://digital.ni.com/public.nsf/allkb/DCB90714981A1F148625731E00797C33
    "Note that if your complex data type is a struct with more than primitive data types (int, double, char), it is easiest to create a wrapper DLL from a C-based language."
    So this is what I have been trying to do, and maybe it is very basic, but if anyone could send me a link on how to create a wrapper DLL, it would be very useful. I already download the one National Instrument made, but I did not really understand it.
    The DLL seems to work fine as I manage to call it from a C console programme. (I send the code too). But I tried to followed some tutorials but I just cannot create a DLL that I could use, so maybe there is something badly set in my IDE (I am using Code::Blocks). So if anybody has any idea of what is going on I would be very grateful. Again, the DLL I tried to make is very basic but if the basic are not ok, there is no point going further.
    This is what is happening right now : I create the dll file following the instruction but when I compile I get this warning:
    "warning: 'int addition(int, int)' redeclared without dllimport attribute: previous dllimport ignored"
    and then I just can't compile the test programm because I get the error: altough I did set the file.a as a linker.
    "undefined reference to `_imp__addition' "
    I send the compressed files that I made, I think there should be everything that is needed to answer me, except the DLL file that is available here http://www.frogaspi.org/download.htm
    Again sorry, but the owner of this library explicitly asked not to purpose a local download so I feel very unconfortable doing that, so please, just click on the link and download it from there.
    I do not know if anybody has ever done what I am trying to do, and I am not asking for someone to do it instead of me, I am sorry if I sound like it in my previous message, this was definitly not my intention.
    Still, the problem of having to write a wrapper seems to be a commun issue for people calling DLL in Labview, and I didn't find answer very clear on how to create a dll. I guess I could eventually find out by myself, but if anybody can help, that would make me save a lot of time.
    Maybe what I am asking is very easy, but again my knowledge about C language is basic, I am not  a computer science student so...
    Anyway, thank in advance,
    Adrien
    Attachments:
    Problem Wrapper.zip ‏31 KB

  • CALL dll FROM form 6i

    Hi I have to call a dll which returns some message by accepting a file name as input.
    The plateform is Oracle form 6i deployed on oracle AS , and Oracle 8i DB as backend.
    Kindly suggest , what can be best startegy-
    call dll using form 6i in client server .
    call dll using 3 tier deployement.
    or make an ASP or JSP application
    Please suggest.
    Prashant

    Calling DLL using form 6i
    Regards,

  • Call dll from my dll

    I Have a dll file for my attendance machine
    and every thing are ok when I call dll from my exe application
    I want to create my own dll which my dll connect to attendance dll and get data from it and then insert data to tables
    a second question
    is there a method for calling my dll through windows batch file or I must create an exe application calling from it

    Let me explain a bit what a VFP DLL is for:
    You can only build one type of DLL, an OLE COM Server DLL. It'll mainly contain OLEPUBLIC class definitions, which are then usable in other programming languages. In any programming language capable to make use of OLE COM Server classes.
    If your project is named mydll.pjx and a prg or vcx contains a class myclass, the final DLL will have the OLE class "mydll.myclass" in it.
    This is overhead, if you use this in VFP. If you want to modularize your application, then create several EXE or build as APP. You can DO some.prg IN some.APP or you can create an object o = NEWOBJECT("myclass","myclasslib.vcx","myapp.app")
    to refer to a class inside a vcx compiled and build together with other project files into an app file.
    But any separation you do complicates the code use. A DLL is only needed, if some other programming language needs to use your VFP code. And that other programming language has to be able to instanciate classes.
    You don't need this, even if other programming languages would be involved. You can compile an EXE and that can be run. If needed with parameters. That's typically much simpler and could even be used by DOS batch files either using the DOS start command
    or directly your.EXE as man DOS commands also are merely EXE files.
    Bye, Olaf.
    Olaf Doschke - TMN Systemberatung GmbH http://www.tmn-systemberatung.de

  • Call dll's function

    In order to call dll's functions in a program, written in graphical
    programming langage (labview), I would like to understand the arguments
    of these functions.
    How can I know, or where can I find the values of the dll's functions
    arguments ?
    For exemple, play a midi file with mciSendString of winmm.dll.

    May be you can find docs for standart Windows API function in help for
    Borland C++, or Visual C++.
    Vincent Chollet wrote:
    > In order to call dll's functions in a program, written in graphical
    > programming langage (labview), I would like to understand the arguments
    > of these functions.
    >
    > How can I know, or where can I find the values of the dll's functions
    > arguments ?
    >
    > For exemple, play a midi file with mciSendString of winmm.dll.

  • Calling DLL using LabVIEW 7.1

    so, i have this DLL which might be compiled using Visual Studio 2003 or Visual Studio 2005.NET.
    question is: Can i call DLL functions using LabVIEW 7.1? has anyone tried it and has any issues loading the DLL?
    i think i have everything right, as far as the configuration of 'Call Library Function Node' is concerned, but i get the
    'error loading DLL - application has failed to start because application config is incorrect'.
    can you please verify if .NET is not causing me issues? i think DLL assembly should be the same wheather it's VStudio6
    or .NET, but can anyone confirm that's not the issue? Thanks...

    Yes.
    If you dll is generated by C/C++, using Call Library Function node.
    If it is generated by .net, using constructor node.
    http://forums.ni.com/ni/board/message?board.id=170&message.id=206959#M206959

Maybe you are looking for

  • How to use travel functionality in ess.

    Hi friends; We are implementing travel management in ess where the employee will create a request for reimbursement and then the concerned finance department person will approv or reject the request and then the respective infotypes will be updated.

  • Catalogs Files to Keep and Catalogs Files to Delete

    How and where do I find and identify the latest working Lightroom Catalog (I think it is "Lightroom 3 Catalog-3.lrcat") and its associated files? And which of the old files in that folder can I delete?

  • Infopackage Conversion Routine option is checked

    Hi everyone, I'm trying to understand the dynamic of the Dataload process in my new client and there is a infopachage where in "Data Selection" tab i have a "Use Conversion Routine" option checked and i don't know where this exact routine is actually

  • Adobe Acrobat Reader 2.0 for Pocket PC (Windows CE 5.0 Core Edition)

    I have a PNA with Windows CE 5.0 Core Platform. If I start the Adobe Acrobat reader I get an error message (App or other components faild). Wich dll's and api's from the current Windows CE Platform I need to work this programm of my Windows CE Core P

  • Locating my Logic studio serial on my Mac?

    Hi there, I cant find my Logic paperwork/manuals at the minute and want to reinstall Logic. Is there a way to find my serial on my Mac? I already have Logic installed. Thanks.