Simple DLL problem

I'm dabbling with DLL writing and can't figure out how to pass a string to a
DLL. As far as I can see, it should be simple.
My DLL function, in the DLL "test.dll", is simply
TEST_API int test(LPCTSTR WinName)
return 0;
Instead of LPCTSTR I've also tried the more conventional "char *WinName",
and a few others. All give the same error; "The exception Priviledged
Instruction occurred in the application at location (blah)." The error
message doesn't seem too specific; exactly the same thing happens if I
deliberately copy some text to an uninitialised pointer.
I'm calling the function using a "Call Library Node", passing a
pre-generated string in the form of a C string pointer. The calling
convention is set to "winapi" but doesn't seem too relevant.
If I remove the string argument and change the function definition to take
(void) then it works, in that I can put integers in the return code and pass
them back to Labview, so it's the passing of the string that's the problem.
However, if I have more code in there and I use the Visual C++ debugger, the
error message is only generated on hitting the "return" line, and I can see
the string that has been passed in when I look at "WinName" in the debugger.
Can anyone shed some light on this?
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK

Craig;
I am going to throw some random thoughts that may help you in your situation:
- I avoid to use VC's wizard. It gives (and gave me) a lot of headaches. All it does it to add a lot of garbage to your project that nobody understand.
- If your source file is a .cpp, wrap your function prototypes inside the extern "C" declaration.
- Always initialize every variable in LabVIEW side. For example, for your function you should wire an empty string in the input side of the "Call Library Node" for the "WinName" variable.
- I claim ignorance in this one, but seems to simplify my projects. Exclude rarely-used Windows header files by adding the following statement before your headers "include":
#define VC_EXTRALEAN
I hope this can be of help. If I co
me up with some more suggestion, I'll let you know.
Best regards;
Enrique
www.vartortech.com

Similar Messages

  • Itunes won't launch anymore: AVFoundationCF.dll problem

    Hi,
    since my last itunes update, it won't launch because of a "AVFoundationCF.dll" problem. I'm on a Windows XP system. Can anyone help me please?

    Taken at face value, you're having trouble with an Apple Application Support program file there. (Apple Application Support is where single copies of program files used by multiple different Apple programs are kept.)
    Let's try something relatively simple first. Restart the PC. Now head into your Add or Remove programs control panel, select "Apple Application Support", click "Change" and then click Repair.
    If no joy after that, try the more rigorous uninstall/reinstall procedure from the following post (although it's for Vista and 7, just read "Computer" as "My Computer", read "Uninstall a program control panel" as "Add or Remove programs control panel" and assume the system is 32-bit, and you'll be doing the right things):
    Re: I recently updated to vista service pack 2 and I updated to itunes 10.2.1 and ever since I did that my itunes won't open any more.  Itunes starts but before anything loads a window pops up saying that the prograam has encountered a problem and sh...

  • Real simple xslt problem/question

    Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. i'm sure that theres a simple solution to it but i just cant figure it out. any helps greatly appreciated, thanks

    Start with the XSLT identity transform (I don't have it handy and it's fairly long, but you should be able to google it up). Add this:<xsl:template match="result">
      <result id="">
        <xsl:apply-templates>
      </result>
    </xsl:template>

  • JDeveloper IDE simple setting problem

    Hi,
    Recently we switched to JDeveloper from Visual Cafe .I have a simple setting problem.How can I set the options so that IDE gives, the core java classes and packages,and our application classes and packeges, prompts in imports as well as in code.Where to set the options.
    eg: when I write
    import java. it should prompt all the pakages.
    Thanks in advance.
    -Gopal
    null

    I am not sure I understand what you are requesting, but ...
    You can configure JDeveloper projects to include various libraries by default.
    This is done by selecting menu Tools | Default Project Properties.../ Libraries tab.
    You should define a library for your classes.
    You can import any of the packages / classes from all the libraries which your project includes.
    It would be incorrect for a tool to automatically add a bunch of import lines at the top of every file because each file should import what it needs and just as importantly, not import what it does not need depending on the component type (e.g. a servlet should not include javax.swing.* ).
    An easy way to import elements into JDeveloper is to type in something like:
    import java.
    // and then type in Ctrl Space
    and this launches the package browser, you can select packages or classes to import.
    You can also do this at the variable declaratiton point such as typing in:
    foo() {
    Frame x
    // Press Control Alt Space
    and this will correctly change the type (Frame) to the type you select in the package browser and add the import statement.
    -John
    null

  • Simple OOP Problem. Help!

    This is just a simple OOP problem that i cant decide on a best
    implementation for.
    im passing an object to an instance of, 'TabbedFrame', which is just
    a frame with a Tabbed Pane in it that is holding custom panels.
    however, these custom panels need access to the object being
    passed to 'TabbedFrame' and to some methods in it.
    i cant make them static however so how do i gain access to them?
    is my only option to pass the 'TabbedFrame' to each panel?
    like - jtabbedpane.add( "Panel 1", new mypanel1(this));
    here is code:
    new TabbedFrame( DataObject );
    public class TabbedFrame{
    public TabbedFrame(DataObject do){
    this.do = do;
    jtabbedpane.add( "Panel 1", new mypanel1() );
    DataObject do;
    public class mypanel1{
    public mypanel1(){
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    }i would just pass the DataObject to evey panel (there are 12) but
    i also need to be able to call methods in the 'TabbedFrame'.
    Any help would be appreciated!

    Modify mypanel1's constructor:
    public class mypanel1{
    TabbedFrame tf;
    public mypanel1(TabbedFrame tf){
    this.tf = tf;
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    DataObject theDo = tf.getDataObject();
    tf.someMethod(); // Call method on the TabbedFrame
    }In TabbedFrame:
    public TabbedFrame(DataObject do){
    this.do = do;
    // Modify call to constructor to pass "this" TabbedFrame.
    jtabbedpane.add( "Panel 1", new mypanel1(this) );
    }

  • Installed 7.1 on new Dell. Windows shuts down as result of "nixsrk.dll" problem.

    I installed LV 7.1 on new Dell with XP.While running the LV application, Windows shuts down to prevent damage to computer as result of "nixsrk.dll" problem. What is the fix?
    Thanks,

    How is your application architected? Are you making calls to DLLs using a Call Library Function Node? It might be that for some reason some of the components for your application were installed correctly on the Dell computers. I would suggest that you try some other application and make sure whether the issue is with your application or LabVIEW installation.
    Regards,
    Chetan K
    AE-NIC

  • NI's answers to .dll problems

    I emailed NI about the lvpng.dll problem I have in LV 5.1.1. If I call
    this .dll to save a png format of the front panel, over time, it
    consumes memory. I'd like you to see the response I got.
    [email protected] writes:
    I tried your VI, and was not able to reproduce the memory leak in
    LabVIEW 6i. This is good news for 6i users.
    Wow, thanks. Do I get a free version of 6i to fix my problem? What is
    the solution?
    Mark
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    Out of respect for Darren, and to clear up the misunderstanding, Darren
    is checking in with R&D to get the problem resolved; thank you.
    The original response, however, did not state anything about checking
    with R&D, or about resolving the problem in 5.1.1. The answer I got
    was:
    Mark,
    I tried your VI, and was not able to reproduce the memory leak in
    LabVIEW 6i.
    It looks like my test goes along with the individual you spoke of from
    the
    usenet. This is good news for 6i users.
    Sincerely,
    I was not entirely happy with the response I was given. Rather than
    wait until I contacted Darren again, I posted this message with the
    response in it, which I am sad to say was careless of me.
    What has transpired since then is that Darren did not realize that I
    don't have the means to upgrade to 6i. It was then in his message back
    to me that he stated that R&D is looking into the problem.
    I apologize for the misunderstanding, and will not make such posts
    again until the situation is resolved.
    Mark
    In article <[email protected]>,
    "Darren Nattinger" wrote:
    >
    > Hello everyone,
    >
    > I am the engineer at National Instruments that responded to Mr.
    Wysong's
    > original question regarding the memory leak with the PNG VIs in
    LabVIEW.
    > The full context of my message actually stated that, although the
    problem
    > appears to be fixed in LabVIEW 6i, I have contacted R&D and am
    awaiting their
    > response regarding a possible resolution with LabVIEW 5.1.1. I have
    related
    > the relative importance of the problem to R&D, so we hope to get a
    speedy
    > reply and/or resolution to Mr. Wysong.
    >
    > Thank you all for your interest in LabVIEW. It is my job to support
    customers
    > who use this product, so I come across all sorts of LabVIEW
    applications
    > every day, and I love it. Please take full advantage of our on-line
    support
    > resources (www.ni.com/support), this newsgroup, and our e-mail support
    system
    > (www.ni.com/ask) whenever you have technical questions about National
    Instruments
    > products.
    >
    > Have a great day,
    > Darren Nattinger
    > LabVIEW Support
    > National Instruments
    >
    > [email protected] wrote:
    > >I emailed NI about the lvpng.dll problem I have in LV 5.1.1. If I
    call>this
    > dll to save a png format of the front panel, over time, it>consumes
    memory.
    > I'd like you to see the response I got.>>
    response>>>[email protected]
    > writes>I tried your VI, and was not able to reproduce the memory
    leak in>LabVIEW
    > 6i. This is good news for 6i users.>>>>Wow, thanks. Do
    I
    > get a free version of 6i to fix my problem? What is>the
    solution?>>Mark>>>>>>Sent
    > via Deja.com http://www.deja.com/>Before you buy.
    >
    Sent via Deja.com http://www.deja.com/
    Before you buy.

  • MSVCR80.dll problem

    Has anyone had a MSVCR80.dll problem when installing the latest version of iTunes? I now am unable to open iTunes at all and cant download a new version either. Help please!

    Solving MSVCR80 issue and Windows iTunes install issues.

  • Help me please dll problems with Windows XP

    My first time installing itunes was a desaster. A messsage appears saying dll problems. And another message " error 0x80040702 IpodFormatSupport"
    My ipod is 4gb.
    MY SYSTEM IS A WINDOWS XP PROFESSIONAL.
    Thanks for any help.

    First, let's make sure your Windows XP is compatible with iPod. Click on Start, Right Click on My Computer, and then Click on Properties. You want to make sure that you have Service Pack 2. (This is the last line of the first section on the "General Tab")
    -If it says Service Pack 1, go to www.microsoft.com and search for Windows XP Service Pack 2. Find it, download it, and then install it. Once you've done that you can try to install your iPod/iTunes software again.
    -If there is no service pack listed, go to www.microsoft.com and search for Windows XP Service Pack 1. Find it, download it, and install it. Then you need to go back and search for Windows XP Service Pack 2, and then download and install it. Then you can try your iPod / iTunes software again.
    If you do have service pack 2 and you're having these issues, try a quick antivirus/spyware/adware scan, and make sure you don't have anything like that.
    If that does not resolve the issue, it could be that your antivirus software is causing interference and not allowing your software to install. Follow the steps in this article, and then try the install again:
    http://docs.info.apple.com/article.html?artnum=302538
    Once you've gone through all of this, reply and let us know what's going on.
    Best wishes,
    CG

  • Avfoundationcf.dll problem!!!!

    someone please tell me why avfoundationcf.dll is missing where did it go???? and how do i get it back???? help before i chuck my notebook in the canal and buy a cd walkman

    Taken at face value, you're having trouble with an Apple Application Support program file there. (Apple Application Support is where single copies of program files used by multiple different Apple programs are kept.)
    Let's try something relatively simple first. Restart the PC. Now head into your Add or Remove programs control panel, select "Apple Application Support", click "Change" and then click Repair.
    If no joy after that, try the more rigorous uninstall/reinstall procedure from the following post (although it's for Vista and 7, just read "Computer" as "My Computer", read "Uninstall a program control panel" as "Add or Remove programs control panel" and assume the system is 32-bit, and you'll be doing the right things):
    Re: I recently updated to vista service pack 2 and I updated to itunes 10.2.1 and ever since I did that my itunes won't open any more.  Itunes starts but before anything loads a window pops up saying that the prograam has encountered a problem and sh...

  • AcroRd32.dll problem?

    Acer aspire 5732Z
    Win 7 home premium 64-bit
    Adobe Reader X (10.1.1.33)
    I discovered last night that both the simple & advanced search functions in Reader have stopped working.
    When I try to search I get an error message "A plug-in used to perform Search is missing. Please reinstall Acrobat". If I click OK the message instantly returns then when I click OK again I get the options to either close the program or check online for a solution (see problem signature, below). If I choose "check online" windows appears to search for +/- 20sec then reader shuts down & that's it....nothing happens & reader still doesn't work when I try it again, even if i reboot 1st.
    I've downloaded & installed the latest reader version from get.adobe.com/reader/ but that doesn't solve the problem. When I looked at the exe file in c:/program filesx86/adobe/reader 10.0/reader/ I noticed its AcroRd32.exe - is that 32-bit?
    I think the problem is with AcroRd32.dll, but don’t know how to be sure or what to do about it if it is. Do I need to replace it &, if so, can anyone point me to a safe place to get it from (I’m reluctant to download it from an unknown source)?
    Thanks
    p.s. About the same time I suddenly got a problem with flash shockwave (I think that’s what’s malfunctioning). I don’t know if/how they’re related but it seems unlikely that two adobe applications should suddenly go wrong at the same time without there being a common cause, so I’m posting about it in the flash forum (“swf files won’t play”) & mentioning this Reader post also.
    Problem signature:
      Problem Event Name:    APPCRASH
      Application Name:    AcroRd32.exe
      Application Version:    10.1.1.33
      Application Timestamp:    4e64e4e2
      Fault Module Name:    AcroRd32.dll
      Fault Module Version:    10.1.1.33
      Fault Module Timestamp:    4e64f98b
      Exception Code:    c0000005
      Exception Offset:    005e3175
      OS Version:    6.1.7600.2.0.0.768.3
      Locale ID:    2057
      Additional Information 1:    0a9e
      Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:    0a9e
      Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

    You cannot open SWF files with "adobe flash player install manager"; you need to associate it with the standalone Flash Player (Projector) from http://www.adobe.com/support/flashplayer/downloads.html

  • Application/DLL problem on Windows Server 2008 R2

    I have an issue with an application which needs to run on a Windows Server 2008 R2 environment.   The issue concerns "msvbvm60.dll" which results in an "APPCRASH" when I try to run the application.
    The APPCRASH reports the issue is with msvbvm60.dll version number "6.0.98.15".   We have another customer with Windows Server 2008 (not R2) which has version "6.0.98.2" of the same file and the application works fine there.
    I've got 2 questions really then ...
    Could I replace the .15 version with .2?   There appear to be 2 "system" folders on the server "C:\windows\system32" and "C:\Windows\syswow64" - would both of these need to be addressed
    Would a later version than .15 cure the problem?
    I've trawled this site but unable to find an exact solution or advice that fits my situation.
    Thank you.

    Which application? Is that a Microsoft product? If not, I would suggest you contact the software developer for assistance.
    ---Could I replace the .15 version with .2?   There appear to be 2 "system" folders on the server "C:\windows\system32" and "C:\Windows\syswow64" - would both of these need to be addressed
    Yes, you may give it a try. Usually, put it in WoW64 folder if it's a 32bit DLL. Otherwise, put it in System32 folder.

  • Simple button problem

    I am having a real problem creating a simple button - I have
    created a Flash file using Action script 2, and when I create a
    simple button - text with a rectangle as a background, (see
    http://www.elkhavenestate.com),
    and the over state is behaving in a bizarre fashion. This is my
    first time using CS3, so is there a new control that I'm
    missing?

    I take it that it's the Home button. It appears to have a
    selectable text field or something in it, which is causing the
    problem. Either change that to a static text field or set its
    selectable property to false. The other two buttons appear to be
    fine, so maybe you can just duplicate one of them and turn it into
    the Home button.
    If I picked the wrong button, let me know.

  • Lookout Client V6.0.2 keeps crashing - lkwrks.dll problem

    On several of my machines running the Lookout client version (6.0.2 with updates), Lookout consistently crashes. Below is the information from Event Viewer:
    Event Type: Error
    Event Source: Application Error
    Event Category: None
    Event ID: 1000
    Date:  4/3/2007
    Time:  12:40:46 PM
    User:  N/A
    Computer: SCADA-SD
    Description:
    Faulting application lookout.exe, version 6.0.2.1, faulting module lkworks.dll, version 6.0.2.1, fault address 0x00021c5b.
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Data:
    0000: 41 70 70 6c 69 63 61 74   Applicat
    0008: 69 6f 6e 20 46 61 69 6c   ion Fail
    0010: 75 72 65 20 20 6c 6f 6f   ure  loo
    0018: 6b 6f 75 74 2e 65 78 65   kout.exe
    0020: 20 36 2e 30 2e 32 2e 31    6.0.2.1
    0028: 20 69 6e 20 6c 6b 77 6f    in lkwo
    0030: 72 6b 73 2e 64 6c 6c 20   rks.dll
    0038: 36 2e 30 2e 32 2e 31 20   6.0.2.1
    0040: 61 74 20 6f 66 66 73 65   at offse
    0048: 74 20 30 30 30 32 31 63   t 00021c
    0050: 35 62 0d 0a                       5b.. 
    Again, this is only happening on machines running the Client version.
    All machines are Dells running Windows XP SP2 and have at least 1 GB of RAM.
    Please respond A.S.A.P.
    Thanks!
    Jason Phillips

    I am aware of the fact that you cannot copy the updated lkworks.dll file to the client version - if you do you will get an "evalutaion version" dialogue box everytime you open the client.
    This problem is occuring with all of the updated files, except "lkworks.dll", copied to the Lookout 6.0 folder.
    I found out late yesterday afternoon that this crash is occuring on machines running the client version and running my client process file. On machines running the client version but not running the client process file, the crash does not occur. For example, I have one machine running the client version and a logging process file which does not crash. Also, on machines running the server version and the client process file, the crash does not occur. So, it appears that the problem has to do with machines running the client version and the client process file. This process file is much bigger than the logging file I had previously mentioned, about 11Mb. Attached are my client and server files to assist you in diagnosing and correcting this problem.
    Please respond A.S.A.P.
    Thanks!
    Jason Phillips

  • Symcjit.dll problem on Windows2000 - Installation of 8.1.6 fails

    Hi,
    I've seen a lot of reference to the JIT dll causing problems
    with P4 chips.
    I'd just like to make note that it can (but not always) cause a
    problem on P3 systems.
    I've confirmed the problem on Windows 2000 Pro and Windows 2000
    Server, using P3 733MHz system with 256 MB RAM, installing
    Oracle 8.1.6 Enterprise Edition.
    The exact problem seems to occur when the OUI tries to launch
    the Database Setup Assistant.
    Just for the sake of being complete, the solution that worked
    for me was:
    1. Copy the entire CD to the HD.
    2. REMOVE (or rename, doesn't matter) the offending file
    (symcjit.dll)
    3. Run Setup.exe
    Contrary to other posts on this site, no other modifications to
    any other files were required. Your mileage, of course, may vary.
    Wow.. what a frustrating 3 days.

    Sorry Eric,
    I posted this as a notice, and never came back. :)
    But since I did leave it vauge, I'll answer the question for anyone else that comes along.
    The file version (obtained by right-click and Properties, Version tab) for the 8.1.6 install is:
    3.10.0.107
    and is 410 kb.
    And the other part: No, you don't need to replace the file. Simply deleting it forces the installer to use a regular java interpreter from the jre on your system, the one currently being used by the Universal Installer perhaps (?), rather than the JIT one you have just deleted.
    It's such an easy fix and appears to cause no problems, I wonder why the installer makes a switch to using it, half way through the install.
    p.s. The reason I came back here is because I need to perform a second installation on a different box, and I had bookmarked this page. :) For once, I was thinking ahead.

Maybe you are looking for