DLL calling convention set-match?

I'm convering an application in a DLL and everything seems to work except when I call it from a stub application I get a Non-fatal runtime error "CVI has detected and the inconsistency of the execution stack" Debugger dialog box when the DLL function returns.

My heel is using the following to load the function:

prototypes:

HINSTANCE hInstSAE;
typedef int(* x_calcSAE) (int, int * short *, char *, CXP_PARAM *);
x_calcSAECG calcSAE = NULL;

then in main():

hInstSAE = LoadLibrary ("SAE.dll");
If (hInstSAE)
calcSAE = (x_calcSAE) GetProcAddress (hInstSAECG, "CAS");

My DLL export function is declared:

int DLLEXPORT sae DLLSTDCALL (int N, int * r, short * data, char * ID, CXP_PARAM * Param);

How can I delete the error?  It does not appear to be a problem, because if I click on continue and calling other than bad going on nothing other than the popup of debugger on each return.  How can I get a stack dump to see what Setup before the call and the return?

Hey wally.

My guess is that you need to change your typedef to the following:

typedef int (* DLLSTDCALL x_calcSAE) (int, int * short *, char *, CXP_PARAM *);

Generally, the default value used by convention to call CVI is __cdecl, which does not match your function prototype __stdcall calling convention.  This means that if you do not specify a calling convention for your function pointer, the __cdecl calling convention will be used.  You must update the function pointer type to match the declared function prototype.

NickB

National Instruments

Tags: NI Software

Similar Questions

  • Nican.dll call python questions

    Hi all

    I have a feeling that this issue will be left without an answer, but I'll ask anyway.

    For a project, I need to use Python2.7 to receive frames from a bus.  What I have to do is monitor CAN all traffic on the bus, I have to send frames.  I searched (and searched and searched) for some sort of solution to this, but have found none.  Here's the code I have so far:

    Test #CAN using Python

    types import *.
    import table *.

    #Load DLL
    CANdll = cdll. LoadLibrary ("NICAN.dll")

    canName = c_char_p ("CAN0")
    canNumAttr = c_ulong (8)

    # Define constants
    NC_TRUE = c_ulong (1)
    NC_TRUE = c_ulong (0)
    NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
    NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)

    # The values taken from nican.h
    #NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
    #NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
    #NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
    #NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
    #NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
    #NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
    #NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
    #NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)

    # instantiate the table a
    canAttrIdList = (c_ulong * 8))

    # Fill the values in the table
    canAttrIdList [0] = c_ulong (0 x 80000007)
    canAttrIdList [1] = c_ulong (0 x 80000006)
    canAttrIdList [2] = c_ulong (0 x 80000013)
    canAttrIdList [3] = c_ulong (0 x 80000014)
    canAttrIdList [4] = c_ulong (0 x 80010001)
    canAttrIdList [5] = c_ulong (0 x 80010002)
    canAttrIdList [6] = c_ulong (0 x 80010003)
    canAttrIdList [7] = c_ulong (0 x 80010004)

    #NC_ATTR_BAUD_RATE = 500000
    #NC_ATTR_START_ON_OPEN = NC_TRUE
    #NC_ATTR_READ_Q_LEN = 100
    #NC_ATTR_WRITE_Q_LEN = 0
    #NC_ATTR_CAN_COMP_STD = 0
    #NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
    #NC_ATTR_CAN_COMP_XTD = 0
    #NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE

    # instantiate table a
    canAttrValueList = (c_ulong * 8)

    # Fill the values in the table
    canAttrValueList [0] = 500000
    canAttrValueList [1] = NC_TRUE
    canAttrValueList [2] = 100
    canAttrValueList [3] = 0
    canAttrValueList [4] = 0
    canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
    canAttrValueList [6] = 0
    canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCARE

    returnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)

    CODE ##END

    Which causes this error:

    Traceback (most recent call changed):
    File "C:\Users\Chadwick\Dropbox\Senior Project\CAN\NI-CAN\ITB CAN\test.py", line 63, in
    returnValue = CANdll.ncConfig (canNumAttr, canAttrIdList, canName, canAttrValueList)
    ValueError: Procedure called with not enough arguments (missing 16 bytes) or bad calling convention

    It seems that I am not calling the function correctly.

    Yes, I understand that nor is not supported by the Python.  However, any help with this is appreciated.

    Thank you

    He is the labour code.  I question the material for how many images of waiting there, then read them individually as I'm having no luck using ncReadMult.  If someone needs to do this, here's a starting point.

    /thread

    types import *.
    import table *.
    import sys
    import of struct
    time of import

    #Load DLL
    CANdll = windll. LoadLibrary ("NICAN.dll")

    NC_ST_READ_AVAIL = c_ulong (0x00000001)
    NC_ATTR_READ_PENDING = c_ulong (0 x 80000011)

    # HEADER INFORMATION RELEVANT C
    # typedef NCTYPE_INT32 NCTYPE_STATUS;
    # typedef NCTYPE_UINT32 NCTYPE_OBJH;

    ##typedef struct {}
    # NCTYPE_ABS_TIME Timestamp;
    # NCTYPE_CAN_ARBID ArbitrationId;
    # FrameType NCTYPE_UINT8;
    # NCTYPE_UINT8 DataLength;
    # NCTYPE_UINT8 data [8];
    #} NCTYPE_CAN_STRUCT;

    class CAN_STRUCT (Structure):
    _fields_ = [("Timestamp", c_ulonglong),
    ("ArbitrationId", c_ulong);
    ("Frames", c_ubyte);
    ('DataLength', c_ubyte);
    («Données», c_ubyte * 8)]

    CAN_receive_buffer = (CAN_STRUCT * 1000))

    Status = c_long (0)
    CAN_HANDLE = c_ulong (0)
    #CAN_data_size = c_ulong (sys.getsizeof (CAN_receive_buffer))
    CAN_data_size = c_ulong (17600)

    CAN_received_size = c_ulong (1)
    CAN_NAME = c_char_p ("CAN0")
    canNumAttr = c_ulong (8)

    # Define constants
    NC_TRUE = c_ulong (1)
    NC_FALSE = c_ulong (0)
    NC_CAN_MASK_STD_DONTCARE = c_ulong (0x00000000)
    NC_CAN_MASK_XTD_DONTCARE = c_ulong (0x00000000)

    # The values taken from nican.h
    #NC_ATTR_BAUD_RATE = c_ulong (0 x 80000007)
    #NC_ATTR_START_ON_OPEN = c_ulong (0 x 80000006)
    #NC_ATTR_READ_Q_LEN = c_ulong (0 x 80000013)
    #NC_ATTR_WRITE_Q_LEN = c_ulong (0 x 80000014)
    #NC_ATTR_CAN_COMP_STD = c_ulong (0 x 80010001)
    #NC_ATTR_CAN_MASK_STD = c_ulong (0 x 80010002)
    #NC_ATTR_CAN_COMP_XTD = c_ulong (0 x 80010003)
    #NC_ATTR_CAN_MASK_XTD = c_ulong (0 x 80010004)
    #NC_ATTR_LISTEN_ONLY 0 X 80010010

    # instantiate the table a
    canAttrIdList = (c_ulong * 9))

    # Fill the values in the table
    canAttrIdList [0] = c_ulong (0 x 80000007)
    canAttrIdList [1] = c_ulong (0 x 80000006)
    canAttrIdList [2] = c_ulong (0 x 80000013)
    canAttrIdList [3] = c_ulong (0 x 80000014)
    canAttrIdList [4] = c_ulong (0 x 80010001)
    canAttrIdList [5] = c_ulong (0 x 80010002)
    canAttrIdList [6] = c_ulong (0 x 80010003)
    canAttrIdList [7] = c_ulong (0 x 80010004)
    canAttrIdList [8] = c_ulong (0 x 80010010)

    #NC_ATTR_BAUD_RATE = 500000
    #NC_ATTR_LISTEN_ONLY = NC_TRUE
    #NC_ATTR_READ_Q_LEN = 100
    #NC_ATTR_WRITE_Q_LEN = 0
    #NC_ATTR_CAN_COMP_STD = 0
    #NC_ATTR_CAN_MASK_STD = NC_CAN_MASK_STD_DONTCARE
    #NC_ATTR_CAN_COMP_XTD = 0
    #NC_ATTR_CAN_MASK_XTD = NC_CAN_MASK_XTD_DONTCARE

    # instantiate table a
    canAttrValueList = (c_ulong * 9)

    # Fill the values in the table
    canAttrValueList [0] = 500000
    canAttrValueList [1] = NC_TRUE
    canAttrValueList [2] = 100
    canAttrValueList [3] = 0
    canAttrValueList [4] = 0
    canAttrValueList [5] = NC_CAN_MASK_STD_DONTCARE
    canAttrValueList [6] = 0
    canAttrValueList [7] = NC_CAN_MASK_XTD_DONTCARE
    canAttrValueList [8] = NC_FALSE

    # Configure the equipment CAN
    Status = CANdll.ncConfig (canNumAttr, canAttrIdList, CAN_NAME, canAttrValueList)
    If Status! = 0 :
    "Printing on"ncConfig"error
    Status of printing

    Status = CANdll.ncOpenObject (CAN_NAME, byref (CAN_HANDLE))
    If Status! = 0 :
    "Printing on"ncOpenObject"error
    Status of printing
    impression CAN_HANDLE.value

    Time.Sleep (1)

    Try:
    Status = CANdll.ncAction (CAN_HANDLE, c_ulong(0x80000001), 0)
    If Status! = 0 :
    "Printing on"ncAction:start"error
    Status of printing
    impression CAN_HANDLE.value

    I have = 0
    ##string = "" data: "".
    String = «»

    pending_CAN_frames = c_ulong (0)
    while I<>
    Status = CANdll.ncGetAttribute (CAN_HANDLE, NC_ATTR_READ_PENDING,
    32, byref (pending_CAN_frames))
    Print "waiting for frames: %d" % pending_CAN_frames.value
    If Status! = 0 :
    "Printing on"ncGetAttribute"error
    Status of printing
    for n in range (0, pending_CAN_frames.value):
    Status = CANdll.ncRead (CAN_HANDLE, CAN_data_size,
    ByRef (CAN_receive_buffer [n]))
    for n in range(0,pending_CAN_frames.value):
    for j in range (0, CAN_receive_buffer [n]. DataLength):
    String = string + '%x' % (CAN_receive_buffer [n]. Data [j])
    print '% X\t%d\t%s' % (CAN_receive_buffer [n]. ArbitrationId, CAN_receive_buffer [n]. DataLength, string)
    String = ' ' #reset chain
             
    I += 1

    # ALWAYS CALL LAST
    Finally:
    Status = CANdll.ncCloseObject (CAN_HANDLE)
    If Status! = 0 :
    "Printing on"ncCloseObject"error
    Status of printing

    /thread

    I hope this helps someone in the future.

  • The DLL call fails when DLL uses a wide range

    I call a C++ dll in LabVIEW 32-bit on Windows 7. I kept getting error 1097 and finally understood it is because the dll uses two large paintings of 5 MB each. The tables are initialized in the constructor of an object, malloc is not used, or whatever it is. If I do the smaller berries, then everything works fine.

    The problem is not difficult to work around, now that I know what is the cause, but can someone tell me why a dll using a lot of memory would be a problem? I feel that 10 MB is really a lot of memory to use on modern computers.

    OK, you can test the appeal of the DLL in a Visual Studio test harness?

    In addition, in case you haven't seen another 'DLL error 1097' son type, here are a few. The cause of 1097 in your case can be illuminated by a multitude of courses of troubleshooting:

    Call dll error 1097

    Error code coming 1097 in DLL call

    error 1097 after the call dll function that allocates memory inside

    1097 error in the transition from table from C++ DLL for LabView (seems very relevant, although long)

    I know there are a lot of reading, but there is a good chance that the magic trick is in one of these threads already. We will ride on the shoulders of their work.

  • How to call the setting menu of the BIOS on HP DV4 1540us netbook?

    Hi all

    How to call the setting menu of the BIOS on HP DV4 1540us netbook?

    F2 does NOT an on-screen BIOS setting.

    Is there another trick?  Or, perhaps, defining the procedure step by step to start the BIOS?

    TIA

    Power on the laptop and all logo HP being displayed, press F10.

  • Error code coming 1097 in DLL call

    Hello

    I get the error code 1097 in the DLL function call. Please find the DLL by calling the function for more information.

    Function: GetControllerListTest (Controller * ptrControllertest, char * max_controller);

     

    Parameter Controllertest details:

    set NO_OF_CONTROLLER 100
    #ifndef CONTROLLER_STRUCT
    typedef struct
    {
    CString name;
    status of tank;
    CString blocked_by;
    Char group;
    } controller;

     

    Data type for the parameter Controllertest is structure. In LabVIEW, I configured the parameter as a cluster.

    name: line control

    status: complete control U8

    blocked_by: control string

    Group: entire control U8

    Could you please confirm it, did I set up the type of data in a correct way?

    I'm getting output empty table and the error Code of the DLL 1097. Can you please tell me where I am missing?

    Thank you

    Sivaramkumar.V

    What type "CString" defined?

    If it's a C++ type, as defined here, then you can not call this function directly from LabVIEW because LabVIEW can not pass of C++ types.  In this case, you will need to write a wrapper (in Visual Studio or another C++ programming environment) which takes a string (character array) standard C as an input, creates a CString from her and calls GetControllerListTest.

    If CString is defined as a fixed-length character array, then you need to replace the strings of LabVIEW with clusters of U8 containing a number of elements equal to the string length (LabVIEW does not support arrays of fixed length).

    If CString is defined as a pointer to a character array, you can pass the data to LabVIEW, but you must call the memory manager of LabVIEW functions to allocate memory for the string data and copy it.

  • From two hexagonal numbers as a variable byte in dll calls

    I imported a DLL, which works well when it was called by C++ codes.  However, a few screws converted did not work properly.  The original functions were supposed to write a set of two hexadecimal numbers (one byte in size) to an address specified in the form of two characters.  Somehow after these functions have been converted to screw, they wrote the first hexagonal number and ignore the rest.  My speculation is that, given that this variable is declared as a type byte, the VIs may only take the first hexadecimal digit as a character (also a byte in size) and ignored the following hexadecimal number.  Has anyone ran into similar problems?

    Configure the setting in COLD LAKE to be a U8 integer instead of a string.

  • LabVIEW DLL called from C

    I would like to create a DLL in LabVIEW which can be called from a C program.

    The purpose of the DLL is to display a dialog box along side a C program user interface and view a picture is updated continuously in the program.

    The LabVIEW DLL would be

    1 would be considered to be a dialog box that opens up along the side of the user interface of the C program.

    2. the DLL would regularly be called with the parameters passed by the C program.

    3. the dialog box would contains a picture that is updated by the parameters of the permanence of program C.

    Is this feasible?  I assume that the DLL has to work like a demon, because the DLL is a dialog that must cover along the side of the user interface of C.  To run a DLL written in LabVIEW, is the needs of PC - the runtime?

    Everything was OK until 5. For 6, you do not get a reference to something C. You simply call the exported function that is the VI 'set params.

    I have included a sample project to give you an idea. The code LabVIEW is written in LV 8.2 and the project with a version of a DLL specification. I used c# for this example, but you can easily translate it c If you wish.

  • In the c# dll call problem

    Hello

    I am new to c#, but I have to write DLLs to LabVIEW that reads the information on windows processes. I prepared the code (work as a Win32 application), it built as a dll and call the library function to call it. I tried another code in C language before and it worked fine. But when I do the same with c#, I have an error in LabVIEW:

    "The name of the function specified for this node is not found in the library. Click the node to call a library function and select Configure, and then choose the name of the correct function. »

    The function I created (I've pasted below this post) a functioning but LabVIEW does not see. Do you have any idea how to solve this problem? I couldn't find a tutorial for c# and LabVIEW, I saw some for c# and I it should work.

    Best regards

    Piotr

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Diagnostics;
    using System.Threading;
    using System.Xml.Linq;

    namespace GetProcessDataLib
    {
    public class ProcessData
    {

    public static String GetProcessDataFunction (out string result)
    {
    String xmlOutput = "";
    Try
    {
    code example
    }
    catch (Exception ex)
    {
    Console.WriteLine (example) Message + "\r\n" + ex. StackTrace + "\r\n" + ex. Source);

    xmlOutput = "";

    }
    result = xmlOutput;
    GetProcessDataFunction (without result);

    return xmlOutput;

    }

    }
    }

    Piotr.Zawistowski wrote:

    Hi Nathan,

    Thanks for the reply. I'm new to c#... I don't know I tried to:

    1 / create DLLs with Visual Studio Command Prompt (32 and 64). I used this command:

    csc/target: library / out: GetProcessDataLib64.DLL GetProcessData.cs

    2 / create DLLs to be taken automatically during construction.

    CSC is the compiler C Sharp and will create a default .net assembly, not a Windows DLL function. If you need to use the .net features in LabVIEW to access. And in any case this source code you can not create a Windows DLL function directly since there is no exportable function in there, but only the .net objects.

    And Nathan, C(++/#) compilers do not create header for the dll files. These header files must be created by the programmer creates the source code of the DLL.

  • problems in C++ dll call

    Hi, I compiled a dll in C++ to write data in a shared data segment, and it works well in Labview. Then I try to call the Dll in C++, it can be built successfully, but will break in the end. I have this problem since almost a whole day and could not find the solution.

    Here are the source files for my Dll and the program calling dynamically.

    DLL:

    Calling program.

    Problem solved.  The work for Labview and C++ dll must be like that. The shared data segment must also be declared as funtion and with 'extern 'C' ' coming. In addition, Labview can read only pointers from dll.

  • dll call problem

    I would use .dll files that have been developed for another application.

    I use TS 4.0 which is recognizing the function of the dll, but when try to run it it does not work.

    I thought that it is not so simple, I've attached to specify a part of module.

    Any help would be appreciated.

    Thank you

    Dear all,

    Thank you for your efforts in trying to help me to get out and find a solution.

    In the meantime, the problem has been resolved.

    The csAudio.dll is an interface between the original application and a DLL that has the function complete as an executable file.

    I saw this for the first time, I could see only csAudio.dll.

    The other DLL (an audiotester) has a function that uses the settings. One of them is a pointer to a string of zero completed (CString).

    The other two:

    -ReceiveBuffer is a variable passed that will be filled by the DLL and contains the results of
    the DLL.

    -ReceiveBufferLen is an integer variable that contains the length of the string buffer.
    The result of the DLL should be zero.

    The only problem still exist it is that if I call this DLL to stop TestStand freezes.

    So I skipped this step and it seems that TS closes and unload the DLL function when finished sequence.

    Best regards

    kopisti

  • The VISA almost a DLL call

    Well, I need to do some tasks finishing with LabVIEW objects inside my DLL. One of these objects is VISA serial port session. In LabVIEW, I can just call VISA VI close and everything goes OK. But in the DLL, it's complicated things because I can't see codes sources (or schema) near visa. I found some information that could use the visa32.dll viClose function in the LabVIEW folder or system32 directory. But when I try to use it with a simple casting to INT32 and passing to int32_t viClose(int32_t objectHandle); It goes to the error on the next launch of the program. Then look at this diagram:

    First the program works allright. Second time, it throws the following error:

    The program works fine with standard close VI of VISA. But it is impossible to use it inside my C++ library. Then I started thinking, appellant viClose simple is not enough for a proper clean-up of resource VISA. I tried viTerminate before viClose, but the problem remains the same.

    So, how can I log VISA properly in the DLL? Perhaps, it is better not to close it at all? There may be memory leaks that...

    Hi Dadreamer,

    I looked this error and we might be able to fix it by closing the VISA sessions automatically. See this knowledge base article for instructions of the environment of LV:http://digital.ni.com/public.nsf/allkb/A2561CDE98B66DD4862566510078264F?OpenDocument. The corresponding section:

    "

    • "In LabVIEW 8.x, select Tools ' Options to display the Options dialog box and select environmentfrom the category list page. "To disable the option, remove the check mark from the check box close automatically to the sessions of VISA and click on the OK button.

    Let me know if it works.

  • Driver dll call

    I am writing a LabView program to control a card scanner. The manufacturer provided a DLL and some examples of C/C++ code for this.  My problem is to find a way to pass the handle from driver in LabView.  C code to call this dll looks like this:

    # define drv_handle void * / / this is the header

    drv_handle hDrv; Returns the handle to the open pilot or NULL in case of error
    hDrv = spcm_hOpen ("/ dev/spcm0"); string the driver to open

    I can get the card to initialize correctly. I can't understand how to move the vacuum * through LabView in other functions.  Any suggestions or places to watch?

    That would have to be a "pointer size whole." signed or unsigned any really, but you should definitely maintain coherent and personally, not signed.

  • Under .dll call of Mobile 6 PDA

    Hello

    I wish I could call a .dll in a SW developed on LabVIEW PDA and I have a problem with regard to the opening of This that me is provided by United Nations levels.

    FYI, I know that it is possible to make such an action (what we already inside of this application) but I want to know it is the necessary details about building the DLL.

    Indeed, should activate parameters specific to the level of the compiler (or other)?

    Pour info: the dll that does not work is generated Microsoft Visual C++ 4.0 integrated on an ARMv4 target (the PDA is ARMv5 TE normally backwards compatible)

    PS: question subsidiary-online is it possible under LabVIEW PDA call an EXE? (IE like what you can do in windows via the call to the command line).

    Thank you.

    Hello

    Calling external code (.exe or .dll) since a VI LabVIEW PDA is not as simple as for a classic VI.

    The two following privileges (and privileges which are mentioned) should be helpful to you:

    Launch an external program of LabVIEW Mobile or Application of Module Touch Panel
    http://digital.NI.com/public.nsf/allkb/8F811FFA7BACEC2486256FC5006DB821?OpenDocument

    Calling external Code in LabVIEW PDA and touch screen
    http://digital.NI.com/public.nsf/allkb/517300B49212795986256DDD00623FEE

    Kind regards

  • LabVIEW dll call struct complex

    Hello

    I'm just creating a LabVIEW library for a Dll driver. The Dll contains complex structures. I just want to know if I can get around creating a wrapper Dll for these calls.

    It is an example of a function call:

    Error AA_querySlaveInfo (handle hSlave, SlaveInfo * pSlaveInfo,)

    int flags);

    typedef struct {}
    vendorId int;
    int productId;
    review of int;
    int series;
    const char * group;
    const char * image;
    const char * order;
    const char * name;
    int objCount;
    DataObjInfo * objs [1];
    } SlaveInfo;

    typedef struct {}
    the type of object int;
    const char * name;
    int bitLength;
    } DataObjInfo;

    Aid is quite aprechiated.

    Thank you

    Hi Keppi,

    This is not possible, sorry. Without the last entry in the struct that it would work, but this pointer to the another struct... you'll need a wrapper for it!

    I hope this helps,

    RMathews

  • Calling functions / set variables in loaded SWF

    You know how you can create a Movieclip object, add a function or a variable, and then call this function or change this variable to the SWF file that includes? I want to be able to do it, only with SWFs that are loaded at run time.

    My "main" SWF is just something the type of menu. The user clicks a button in my HAND. SWF and the HAND. SWF and then load the SWF associated with this button, using the AS 3.0 method Loader () - URLRequest () - addChild () that everyone always asks questions on prescribed.

    It works very well. But now I have a few custom and other objects (ie., not only the channels) in my HAND. SWF I want power sharing with the loaded SWF files. preferably, I'd use a function of the type of accessor (ie., LoadedSWF.GiveMeTheCoolObject (MyCoolObject)); Although at this point, I'm willing to hack the object itself (ie., LoadedSWF.CoolObject.CoolField = MyCoolObject.CoolField ;) if that's what it takes.

    I tried to call the functions and setting the fields, but the AS 3.0 compiler doesn't care for this kind of nonsense on its objects defined by the generically. Also note that, at runtime, a call to LoadedSWF.hasOwnObject ("GiveMeTheCoolObject") returns true.

    So my colleagues big brain, what is the magic?

    In advance, thank you for the help!
    Scott

    Kglad,

    Quote:
    Posted by: kglad
    the error message, seems, your function expects a member of the class MyCoolObject, correct?
    and MyCoolObject is not an instance of this class. so, you have to fix that. That is to say, create a member of this class, and use this class as a parameter of the function member.

    Heh, that's what the error message says all right. But the object IS actually an object of class MyCoolObject. I looked at this thing for hours and MyCoolObject IS an instance of this class. I tried different combinations of casting (including the cast on an object and passing that) but had no luck whatsoever.

    So I googled this particular runtime error message ("Error #1034: has no Type constraint: cannot convert '" ") and found a ton of links to other people with a similar problem. As a general rule, the problem was just as you say, someone passes a button as a string, that kinda thing. But a guy had a problem with an object that it has derived from the event class. Once the hours spent trying to make it work, he has tried to override clone() of the base class method and got it to work:

    http://www.assertTrue.com/articles/2006/10/14/custom-events-in-ActionScript-3-0

    As for my project, I took a long, hard look at the overall architecture of my project and decided it would be better if all the 'real work' is held in the HAND. SWF file. This approach would solve some other problems, and it makes sense in a mindset of "separating the display of data.

    If (and this is the interesting part) I changed the API for the LOADED. SWF to accept the pairs of strings (ie., LoadedSWF.AddToDisplay (String Name, String Data)) rather than accept MyCoolObj. Ran and Viola, now we work without any throw exceptions in. After this moment of glory, I created a couple of other APIs that comes from base classes (a type int, the other a type function) agreed and was happily on my way.

    On this basis, I understand while passing another base class objects (IE, the derived class) to load MovieClips via custom function API is... perhaps not so simple you'd expect. In the grand scheme of things well, not a big deal: as far as I'm concerned AS3 rocks.

    Kglad, thanks again for all the help: your comments on how this was the big push that I needed to get through the last barrier of this project.

    For those who read this topic for the ' how to call functions or set variables in a loaded SWF file?

    The short answer is cast to the SWF file that is loaded as a MovieClip content object and then call the function or change the variable:

    Load the SWF file (you saw this code a million times)
    var LoadedSWFObj:Loader = new Loader();
    var MyURL:URLRequest = new URLRequest("LoadThisSWF.SWF");
    LoadedSWFObj.load (MyURL);

    It is within your Event.COMPLETE Manager:

    Cast as a MovieClip object and work with it.
    var LoadedSWF:MovieClip = LoadedSWFObj.content as MovieClip;

    or another way to perform a cast:
    var LoadedSWF:MovieClip = MovieClip (LoadedSWFObj.content);

    Call yer function:
    LoadedSWF.CallMe ();

Maybe you are looking for

  • Satellite A100 freezes

    Hello world Sorry for my English but I'm French. I'll try to do my best to describe my problem. I bought Satellite A100 2 months ago.After I completed the installation of Vista, I changed the partition of my hard disk, I put a few MB on my my d: C:I

  • Yet WT8 - BITLOCK-how to create a key?

    Hi all. I have no need of BitLock on my Toshiba WT8 yet, but if you read my last post, you will see that he did a heck of a headache. To reduce the risk to be locked AGAIN somehow or other, I don't know how it happened the last time that I didn't act

  • How 'add to home screen' a website on MBP 2015 icon

    How can you "add to home screen" an icon of MBP 2015 website.  All I can find on my MBP is "add a bookmark!

  • cq58: computer hp laptop to turn off mode

    I forgot the password and now I get a disabled system 70111473. need help

  • Pdf email attachments problem

    Whenever I try to send a document as a PDF, which is longer than three or four pages, it is said that it exceeds the maximum size allowed.  Is there any kind of a fix for this?