Call function from C++ (dll file) in Flex

Hi,
i using Adobe Flash Builder with Flex 4 , i write a C++ Code in dll File , i need to access to my Function in dll file in Flex ?? what should i do ??

Lets make sure you are performing the correct actions:
1.  Place a Call Library Function node on your block diagram.
2.  Double click the node to open up the Call Library Function dialog box.
3.  Click the Browse button and navigate to the DLL function.  Select the proper DLL and click Open, or just double click on DLL.
4.  On the Function Name box, click on down arrow.  A list of functions found in the DLL should be displayed.  Choose the function.
5.  On the Calling Conventions box, click on down arrow and select C or WINAPI.  In your case, it should probably be C.
6.  The Parameter box should show return type.  In the Type box, select the data type of the return value.  Since you won't see HRESULT here, you need to find out what data type HRESULT is in the C code.  I would guess it is a numeric so select numeric from the drop down list.
7.  Click the Add a Parameter After button.
8.  In the Parameter box, change the name arg1 to the actual name of your first parameter, which is byPortNumber.
9.  In the Type box, choose Numeric, since a BYTE is a numeric in Labview.
10. In the Data Type box, choose Unsigned 8-bit Integer, since a BYTE is a U8 in Labview.
11. In the Pass box, choose Value.  If the C parameter was a pointer (*BYTE), you would choose Pointer to Value.
12. Verify that the contents of the Function Prototype box contains the correct syntax according to the C declaration.
         C:  HRESULT RSPInitComm (BYTE byPortNumber)   should be in Labview: long RSPInitComm(Unsigned char byPortNumber)
13. Click OK button.
Try it out.
If you get a crash, change the Calling Convention to WINAPI.
- tbob
Inventor of the WORM Global

Similar Messages

  • How to call function in included dll file through java application.

    Hi All,
    i am trying to create an java application which call c# functions using JNI. i am completed with the code and it is running fine when i tried to run from netbeans IDE. But when i tried from Calculator.jar file, first time it throws this error:
    F:\JavaProjects\Calculator\dist>Java -jar Calculator.jar
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no CSharpClient in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at calculator.CalculatorApp.<clinit>(CalculatorApp.java:20)
    After that i included that dll file in the cuurent directory. And compiled and tried to run, it throws an unexpected error:
    F:\JavaProjects\Calculator\dist>Java -jar Calculator.jar
    *# An unexpected error has been detected by Java Runtime Environment:*
    *# Internal Error (0xe0434f4d), pid=2640, tid=3700*
    *# Java VM: Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode, sharing)*
    *# Problematic frame:*
    *# C [kernel32.dll+0x12a5b]*
    *# An error report file with more information is saved as hs_err_pid2640.log*
    *# If you would like to submit a bug report, please visit:*
    *# http://java.sun.com/webapps/bugreport/crash.jsp*
    Anyone have idea how to solve this error.
    Thanks in advance.

    This error is created whenever things go sour on the native side. The first thing you can try, and I assume you are using a Java<->C++<->C# bridge which includes two dlls, one created by C++ and another by C#. Is to make sure that the C# dll is compiled using /t:module switch during compilation.
    If you are using VS2008, or VS2005, you can add a post build syntax like:
    csc /t:module /out:"$(ProjectDir)$(OutDir)YourModule.dll" "$(ProjectDir)YourCSfile.cs"
    Hope this helps! If not, ensure first that the native code works by creating a native test app for it.

  • Calling functions from a .JS file

    Good morning,
    I stored my Javascript functions in a .JS file and saved the file in the /i/javascript folder on my APEX server.
    In the HTML Header field I put the following code: <strong>&lt;script src="#IMAGE_PREFIX#javascript/P9001.js" type="text/javascript"&gt;&lt;/script&gt;</strong>.
    In the HTML Body Attribute field I put the following code: <strong>javascript: onLoad='P9001PageLoad()';</strong>
    When the page loads I get the error "<em>Object Expected</em>" on Line 21, Char 1. (When I view the source, line 21 is the line with the code from the HTML Body Attribute Field.)
    Also, in the source HTML of the page, line 17 has <strong>&lt;script src="/i/javascript/P9001.js" type="text/javascript"&gt;&lt;/script&gt;</strong> which I assume is how the APEX engine renders the code I typed into the HTML Header field, so I think that I typed it correctly.
    I am including the JS function that I am trying to call, but I do not believe there is a problem with the code. If I put the code into the Header Text Field then the function is called, and runs as expected. I beleive my issue has something to do with the JS files.
    function P9001PageLoad() {
    // Called on pageload to populate the Select Lists with the values in the
    // hidden fields. The Hidden fields are populated by P9001_PROC_PAGELOAD.
    var i = 1;
    var counter = 0;
    for (i=1;i&lt;=8;i++) {
    var slst_simp = document.getElementById("P9001_SLST_SIMPQS_Q" + i);
    var hidn_simp = document.getElementById("P9001_HIDN_SIMPQS_Q" + i);
    if (hidn_simp.value != parseInt(hidn_simp.value)) {
    slst_simp.value = null
    counter++
    else {
    slst_simp.value = hidn_simp.value
    if (counter &lt;8) {
    var i = 1;
    var counter = 0;
    for (i=1;i&lt;=8;i++) {
    var slst_simp = document.getElementById("P9001_SLST_SIMPQS_Q" + i);
    var hidn_simp = document.getElementById("P9001_HIDN_SIMPQS_Q" + i);
    if (hidn_simp.value != parseInt(hidn_simp.value)) {
    slst_simp.style.backgroundColor = "#dd0000"
    Any advice you can offer in helping me utilizing .JS files would be greatly appreciated! Thank you in advance.
    Donald Semensky.

    Hi,
    One other thing you should try - ensure that all command lines in the script end with ; eg:
    slst_simp.value = nullshould be:
    slst_simp.value = null;In some cases, this can actually cause errors further down in the code.
    You could simplify this test by creating a very small script:
    function test() {
    alert("Hello");
    }Run that in your onload and see if a message pops up. If it does, it means that your script contains errors that stops the script from being used and any call to it would return an invalid object type error message.
    Andy

  • CVI crashes when calling function from external DLL

    I'm calling a CVI library from Test Stand 4.1.  In that CVI library I load an external DLL (using LoadLibrary) and create a few function pointers (using GetProcAddress).  The DLL loads successfully, and I get addresses for all of the imported functions.  
    However, when I one of the functions is called CVI crashes (Test Stand says it lost the ActiveX connection to CVI) when executing in an external CVI instance.  If executed in the Test Stand process I get a system level exception.
    If I step through the code in CVI, it hangs after trying to step into or over the call to the function pointer from the external DLL.
    I am able to call the functions in a small test project I created in CVI, however when integrating it into an existing test library and calling it through Test Stand it fails.
    Any ideas on how to go about debugging this issue?

    Have you tried calling into the dll that CVI calls directly from TestStand?  I am curious to know if this also crashes.
    I am also curious to know if there are any path references in the dll that is called by the CVI program.  If so are they relative, or absolute paths?
    I ask because one of the possibilities is that relative paths are being used to specify a path from the location of the code that is called, and they are not working because the current working directory is being specified by TestStand, and the paths are not relative to the working directory given by TestStand.
    Jensen
    National Instruments
    Applications Engineer

  • Calling functions from a DLL

    I am currently using Oracle to retrieve a BLOB data to process it. The only way I have of intepreting the BLOB is through a function of a DLL provided by my supplier. Is there anyway of doing so?
    Any Help is very greatly appreciated. Thanks

    Unless you have worked with the JNI before or are long accustomed to "just figuring it out due to lack of documentation and information", you really will not glean too much information just from looking at the JNI itself.
    In a nutshell, what you need to do is: create one or more Java classes which contain native methods appropriate for your use; compile these classes; use the 'javah' to process each class that contains native method declarations in each class; copy the generated C header files to C/++ source files; implement each C function (each function corresponds to precisely one native method declaration) in each C/C++ source file as appropriate for your needs (e.g., do Oracle ju-ju (this is where the real beef of the JNI comes in - functions to get data out of the VM and from the Java environment - threads, objects, and so on); compile and link the C/C++ source code into a DLL for Windoze and a shared object for Unix (note that when you compile you will actually need to include two directories from the JDK, not just one - the second directory provides the platform specific definitions of types and so forth). Having done all that, you essentially can now use that/those class/classes in the Java world to hit the Oracle ju-ju, or whatever it does, from a Java perspective.
    For more information, see the Java Native Interface tutorial trial at http://java.sun.com/docs/books/tutorial/native1.1/index.html

  • Call function from "CP210xManufacturing.dll"- Silicon Labs

    I am developing a production line test system that includes retrieving and setting the VID, PID, product string, serial number maximum power consumption of a Silicon Labs CP2102 USB - UART bridge using Labview 8.2.
    Unfortunately I could only call one function { CP210x_GetNumbDevices() }. Wondering any one can help me to call others.
    The Document  : http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/Interface/en/an144.pdf
    CP210xManufacturing.dll :http://www.silabs.com/public/documents/software_doc/othersoftware/Microcontrollers/Interface/en/an14...
    Tuong

    G'day Tuong,
    I'm having issues finding the device i want (VID / PID) on my machine using the "CP210xManufacturing.dl"and calling function "CP210x_GetNumDevices()"...
    Just wondering if you have any details on this....
    Hahaha, I just saw the date you wrote this thread... Hmmm, I might just ask you at work tomoz...
    Cheers
    Tim

  • Calling a function from a DLL, exectution in background mode.

    Dear Experts,
    We have created an ABAP report the calls a function from a DLL file. If the report is executed in on-line mode the program calls and executes the function from the DLL, but if the ABAP programa is executed in background mode it doesnt calls the DLL function.
    Do you know a way to solve the problem when executing in background mode?
    Best regards.
    Antonio

    Hi Gabriel,
    Let me explain in details about my DLL function.
    We are importing the business partners from legacy system into the SAP CRM system, so at the moment we created the BP master data via BAPI, I get the name of the BP and this moment I call the function in the DLL file. I export the parameter name and I receive back a simplified string with the name reduced to a code. This code I get back from the dll it is insert in a Z table, so there is no interaction in the screen, all must be executed in background mode, because there are a lot of business partners to be converted in SAP system.
    I am sending my code for your considerations.
    Instancia a DLL
      CREATE OBJECT dll 'MTCODE.CPFONET'.
      IF sy-subrc NE 0.
        RAISE without_dll.
      ENDIF.
    Move para a tabela interna IT_NAME os valores recebidos na TI_NAME
      it_name[] = ti_name[].
    Para cada registro importado
      LOOP AT it_name.
        CLEAR v_string_ret.
        wa_matchcode-zregid     = it_name-zregid.
        wa_matchcode-name1_text = it_name-name1_text.
        v_string = it_name-name1_text.
        CONDENSE  v_string.
        TRANSLATE v_string TO UPPER CASE.
        CALL METHOD  OF dll 'SetNome' EXPORTING #1 = v_string.
        CALL METHOD  OF dll 'ExecMatch'.
        CALL METHOD  OF DLL 'GetMCData' = v_string_ret.
        FREE OBJECT dll.
      Preenche os campos do match-code de acordo com o retorno da DLL
        SPLIT v_string_ret
        AT '|'
        INTO wa_matchcode-zparmcln
             wa_matchcode-zparmcfn
             v_empty
             wa_matchcode-name_first
             wa_matchcode-name_last
             wa_matchcode-namemiddle.
      Adiciona o registro com o match-code correspondente na TE_MATCHCODE
        APPEND wa_matchcode TO te_matchcode.
      ENDLOOP.

  • Can Any one tell me what is the step in calling a function from a *.lib file in Labview application

    Hi, I am working on Labview 8.0.
    I am trying to  communicate to a thrid party HW using the driver file he has provided to me.
    The drive file is a *.lib file.
    I am unable to call the function from the lib file.
    I could get only from a DLL.
    Pls help .
    Regards
    -Patil

    patil wrote:
    When it is possible in Lab Windows, why calling a function from a static library is prohibited?
    I was trying to use Function node, but found that it is only for functions from a DLL file.
    Will CIN be useful.? 
    LabWindows is not the same as LabVIEW. LabVIEW cannot call .lib files. LIB files are intermediary products and you need to use a wrapper DLL that's compatible with the object format of the .lib file. It's as simple as that. LabWindows creates C application and from that perspective is no different than a regular C
    compiler. That's why you can call .lib files because that's how .lib
    files are used.
    A CIN, as pointed out, is something completely different and will not help you.  

  • Calling an external C function from a C file in JNI

    Hello,
    I am trying to call an external C function, from a C file which is being called by a Java file. I am getting an unresolved symbol error. I have tried many things like, making the external C function in the format of JNI, etc, etc. It is still not working. I think it has something to do with linking the two C files. If anyone can please answer this, it would greatly help me. here is the code:
    HelloWorld.c:
    #include <jni.h>
    #include <stdio.h>
    #include "MyOldHello.h"
    #include "HelloWorld.h"
    JNIEXPORT void JNICALL
    Java_HelloWorld_print(JNIEnv *env, jobject obj)
         helloPrint();
         return;
    HelloWorld.java:
    class HelloWorld
         private native void print();
         public static void main(String[] args)
              new HelloWorld().print();
         static
              System.loadLibrary("HelloWorld");
              System.loadLibrary("MyOldHello");
    MyOldHello.c:
    #include <jni.h>
    #include <stdio.h>
    #include "MyOldHello.h"
    void helloPrint()
         printf("\nHello World!\n");
    MyOldHello.h:
    void helloPrint();
    Now i use the Visual C++ command prompt to compile this by saying:
    javac HelloWorld.java
    javah -jni HelloWorld
    cl -Ic:\Java\jdk1.6.0_20\include -Ic:\Java\jdk1.6.0_20\include\win32 -MD -LD HelloWorld.c -FeHelloWorld.dll
    and now it gives me the error saying that there is an unresolved external symbol, which is the call to helloPrint in the file HelloWorld.
    If anyone knows how to solve this, or how to call external C functions from a C file that is being called from a Java file using JNI, please respond.
    Thanks
    Nick

    Hi,
    In your post on velocity review, you did not compile MyOldHello.c. You compiled a C file that included the header file for it and called a method defined in the header. The linker is never going to be able to find the code for this if you do not include the object file for this.
    Try this. You will also have to add in any JNI libraries you need to link against but I am sure you could work that out.
    cl /c MyOldHello.c
    cl /c -Ic:\Java\jdk1.6.0_20\include -Ic:\Java\jdk1.6.0_20\include\win32 -MD HelloWorld.c
    cl /LD MyOldHello.obj HelloWorld.obj /FeHelloWorld.dll
    [http://msdn.microsoft.com/en-us/library/f35ctcxw(VS.80).aspx]
    Cheers,
    Shane

  • Can I call a function from a dll in LabVIEW that returns:double*string and int.?

    I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?

    pcbv wrote:
    > Hello all,<br><br>The header of the function is:
    >
    > "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
    >
    > where WRAPI_NDIS_DEVICE have this form:
    >
    > typedef struct WRAPI_NDIS_DEVICE<br>{<br>
    > WCHAR *pDeviceName;<br>
    > WCHAR *pDeviceDescription;<br><br>}
    > WRAPI_NDIS_DEVICE;<br><br>
    >
    > The function is from WRAPI.dll, used for communication with wireless card.
    > For my application I need to call in LabVIEW this function.
    Two difficulties I can see with this.
    First the application seems to allocate the array of references
    internally and return a pointer to that array. In that case there must
    be another function which then deallocates that array again.
    Then you would need to setup the function call to have a pointer to an
    int32 number for the deviceList parameter and another pointer to int32
    one for the plItems parameter.
    Then create another function in your DLL similar to this:
    HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
    CHAR lpszDeviceName, LONG lenDeviceName,
    CHAR lpszDeviceDesc, LONG lenDeviceDesc)
    if (!lpDeviceList)
    return ERROR_INV_PARAMETER;
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceName, -1,
    lpszDeviceName, lenDeviceName,
    NULL, NULL);
    if (lpDeviceList[i].pDeviceName)
    WideCharToMultiByte(CP_ACP, 0,
    pDeviceList[i].pDeviceDescription, -1,
    lpszDeviceDesc, lenDeviceDesc,
    NULL, NULL);
    return NO_ERROR;
    Pass the int32 you got from the first parameter of the previous call as
    a simple int32 passed by value to this function (and make sure you don't
    call this function with a higher index than (plItems - 1) returned from
    the first function.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call multiple functions from same dll with call library function

    hi,
    i am working on a project in wich we need to make a UI to read out a sensor network.
    the UI should be usable in any project, but every node needs a different piece of code depending on the type of sensor with wich it is equipt.
    so i need to be able to call different pieces of code when i need them, and still be able to use the UI in future projects with possibly new types of node we now don't have.
    so someone told me to use DLL's, cause then i would be able to call the code i need the moment i need it.
    but i have never worked with DLL's (just learned about this option 3 day's ago) so i have a question.
    i know i can dynamicly change the DLL i call with the call library function, but can i dynamicly change the function i call from that DLL ?
    or do i have to put a new call library function for each function i want to call, even if its from the same DLL ?
    kind regards,
    stijn

    nazarim wrote:
    ok so there is no (easy and ubderstandable) way for me to dynamicly change wich function i want to call from a certain DLL.
    but now i started wondering, the path on the call library function is not ment to dynamicly change a DLL
    but it does work so, if i am carefull, can i use it for that purpose or will labview give me a series of problems once i start using it in larger programs ?
    Thepath on the Call Library Node can be used to load a different DLL. Obviously since you can't change the function name your other DLL would have to export exactly the same function name and of course with the same parameters. This is seldom the case so it is not the main use of the path input to the Call Library Node. It's main use is as indicated to load DLLs at runtime rather than at load time of a VI. So that an application can run even when the DLL is missing, until the moment the functionality from that DLL is needed.
    If you can make sure that all your DLLs export the same function name with the same parameter you can use the Call Library Node to call into different DLLs through the path input. If however you would need to call different function names you would have to resolve to some DLL which does do the dispatching and invocation using LoadLibrary() and GetProcAddress(). But unless you need to go with DLLs for some reason using the Call By Reference Node can give you an even more flexible approach. 
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • What is the syntax for calling function from class file by jsp

    does anyone here knows what is the syntax of how to call a function from java class file by javascript code or any way to call it?
    and where should i put the calling function code? because the function is called depend on the user click.
    for example
    <%=pc.functionName(a,b)%>
    for the variable a and b, how can i get the value from html textbox and put it in a and b...
    urgent needed...
    thx

    Jsp's are executed before the Html forms are created and loaded. Dont try to use a java code function calling on a javascript click. You'll have to explicitly redirect it into a servlet where in you can call the function you want.
    Well! another way could be using AJAX. That seems to be powerfull enough and it might also serve your purpose.
    Hope this helps

  • Calling a function from a dll written by using visual studio c++

    Hi, how can i call a function from a dll which is written by visual studio c++ in test stand?  Although the functions in dll are exported and i've chosen c/c++ adapter, i saw no function in test stand. Is there a different step while i'm calling a function from a dll written by c++ than calling a function from a dll written by cvi?

    Hey Sadik,
    Selecting the C/C++ DLL Adapter Module should be sufficient for this. When you drag an action step for this onto the Main Step and navigate to the location of the DLL, the function list should populate and you should be able to select the function you want to use. If this is not the case, would you be able to post this DLL so that we can test this on our end?
    Regards,
    Jackie
    DAQ Product Marketing Engineer
    National Instruments

  • Calling a native function from a dll

    Hi all,
    I want to call an api function exported from a dll using java. For example l like to call a function from kernel.dll (Windows). How can i do this. Do i have to create another dll for this?

    hi,
    you need to use JNI
    you have to create de DLL , and call kernel32.dll in.
    like that:
    java_class.class ==> first_dll.dll ==> kernel32.dll

  • How to call a function from a JAR file

    Hi ALL,
    I am trying to call a Public function from a JAR file from my JAVA
    file. Can you please provide an example or suggest a good resource?
    Basically my java file Test.Java should call a function called 'export_a_doc' from a JAR file Export.jar. How do I refer this in my Java file and call 'export_a_doc'?
    Thanx

    Hi,
    HERE IS MY JAVA FILE
    // We need this for Starting our Export Process
    import com.newexport.Myclass;
    public class MyTest {
         // Our function to Start Export
         protected static void test(String[] args) {
         System.out.println("Starting. \n---------------------");
         Myclass p = new Myclass();
         try {
    p.Start_Export(args);
    System.out.println("Finished. \n---------------------");
         } catch(Exception e) {
    e.printStackTrace();
         public static void main(String[] args) {
         test(args);
    HERE IS THE BATCH FILE TO BUILD AND RUN
    cd \JNI\Srcs
    echo "-------------"
    c:\JBuilder7\jdk1.3.1\bin\javac -classpath C:\JNI\Export.jar MyTest.java
    echo "-------------"
    \JBuilder7\jdk1.3.1\bin\java.exe -classpath c:\JNI\Export.jar MyTest
    The Export.jar uses other jar files
    Raj

Maybe you are looking for

  • Cannot send email from Hotmail on iphone 5

    This worked just fine up until 3 days ago.  I have deleted and re installed.  I have created under the microsoft Outlook account and also the other account.  It keeps telling me that my pass word is not correct.  I have updated and checked everything

  • Itunes 12.1.1.4 not installing windows 7 64 bit

    I am running windows 7 64bit It is up to date New Itunes 64 bit 4.1.4 does not install error says Itunes mobile helper exe will not open

  • Script task how to add date value

    hi i have following code i am trying to add date into script task  Public Overrides Sub CreateNewOutputRows()         Dim vars As IDTSVariables100         Dim vars1 As IDTSVariable100         Dim recordCount As Integer         Dim rdate As Date      

  • Black frame around image icon during Web Start start up

    Hi, Sometimes I can see black frame (16 pixels) around my own icon during resource files downloading. My icon resolution is 32*32 pixels. It appears like Web Start assignes size of the icon to 64*64 pixels and all space around my 32*32 icon is filled

  • What´s the font used to compose the Illustrator screens?

    Hi An user asked me outside the forum but I was not able to answer...this question now is more for curiosity than asking him. What´s the font family used in the Adobe Products (Illustrator spec...)...I mean what´s the font family used to compose the