Debugging a JNI DLL created with Visual C++

Hello.
Due to the necessary libraries, I need to create a DLL in Visual C++ to be called from my Java class:
System.loadLibrary("my_dll_name");
But I've got a problem: I'm newbie in Visual C++ and I would like to debug the DLL, so when I press F5 (Go for Debug mode), I get the message "Please specify the executable file". Obviously, I've got a DLL, not an .exe or .com file.
I would be extremely obliged if anybody could share any experience.
Thank you very much.

What you nee to do is this:
Run your java app (in an IDE if poss.) and have it pause at some point (if its a command line app., wait for a key, if its a Swing app, you're ok, just wait for the app. to appear. Now start VC6 and go
menus:
Build/StartDebug/Attach to process. Ther should be one process calleed java. Attach to that. If your DLL has debug info in it, you should be able to navigae to the source and set breakpoints etc.
Alternativly, you could just put OutputDebugString(...) (this is a Win32 function) statements in your DLL and use DBMON.EXE (from the win32 SDK) to look at the output.

Similar Messages

  • Required Windows updates to run/load dlls created with Visual C++ 2013

    I have dlls created with VS2013 C++. Dlls are statically linked with runtime libraries and therefore do not require the redistributable to run on a machine that does not have VS2013 installed.
    I have a test machine with Win7 SP1 64-bit without any windows updates. When I try to load a dll created with VS2013 in an executable on that machine, the code dies. Another test machine with windows 7 SP1 fully updated using windows updates loads the same
    dll without a problem and the code runs fine.
    My question is which windows updates for Win 7 and Win 8  are necessary for dll created with VS2013 to load and run?
    Thanks. 

    I did use dependency walker. In my post above (third post in the thread) I actually state that: 
    "The code crashes(=dies) on the machine without windows updates. I used dependency walker and there are no missing dlls.
    Even if there were missing dlls, which there are none, those would be system dlls, because a machine with fully up to date Win7 loads and executes the code without a problem."
    The dll is statically linked (/Mt flag was used). For a good measure I installed redistributable which did not solve the problem. Besides static linking applies to runtime dlls, not the system dlls.

  • Debugging a JNI dll

    Hello,
    anyone have any clues on how to debug a JNI dll from visual studio? Just attach to the Java process in question, and place your breakpoint?
    Regards,
    Helge Fredriksen

    1. Open your DLL project in VS, and set breakpoints as you need them
    2. Search the VS settings for one which is the "calling program". Make the calling program java.exe.
    3. Supply commandline parameters to be passed to java.exe, such that the JVM runs your java program.

  • Multiplication error in DLLs created with SIT

    I have a problem with a multiplication in a DLL created with the Mathwork's Matlab/Simulink and National Instruments SIT. When multiplying two values of different types (fixed point types) I get really strange and unexplainable results. When I run the simulation in Simulink only, I do not get the error. But when running the same program as DLL in Labview I get a result of 146.xxx instead of 235. Feel free to chck out the included files (.mdl, .dll, .vi).
    I'm desperately looking for solutions.
    Philip
    Attachments:
    interface_test.vi ‏34 KB
    interface_test.dll ‏130 KB
    interface_test.mdl ‏11 KB

    Go ahead and hook up your error clusters and attach them to an indicator. This way you can see if there is a labVIEW problem with your code.
    I cannot run your code myself because of a lack of software but I opened the VI up and saw it was missing error handling.

  • Importing a DLL created with Cygwin

    I am trying to import a DLL created with Cygwin. This is a test DLL created by one of my collegue to validate the import process.
    When I use the import Wizzard, everything run ok. It recognise and build the structure based on the header file.
    When I click ok to generate the wrapper, the progress bar shows but nothing happens. I have to terminate the program (not responding).
    I found in the discussion forum that many users were having similar problem. I also found an interesting article on the subject: http://zone.ni.com/devzone/cda/tut/p/id/5412
    Following this, I reinstalled Cygwin with the packages mentioned in the article :
    gcc
    make
    sharutils
    tclck
    wget
    I also place the Cygwin path in the system path variable. I have also found that if the Cygwin path is not in the system path variable, the wizzard complete ok but the DLL is not able to run (cygwin1.dll is missing).
    Any help will be appreciated.
    RD

    I Claire, I am using Labview 8.6 the demo version.
    What I did is to do a scan of the bulletin board. http://forums.ni.com/ni/board/message?board.id=170​&message.id=384919&requireLogin=False
    I Can't say if this is the same problem I am experiencing but it looks very similar
    I have a Dell Latitude D830
    I have attached a copy of the DLL and an executable that is the core of the DLL.
    Hope this will help you figure it out.
    RD
    Attachments:
    dll.zip ‏4 KB
    test.zip ‏3 KB

  • How can I debug a DLL created with MS Visual Studio C++ using CVI?

    I have developed a DLL using MS Visual Studio C++, which is called by an other application written in CVI.
    My goal is to debug the DLL written with C++ when is called from CVI.
    So far I have some msg popups, but I would like to have more debugging capabilities.
    Thanks, Adalbert

    Hello Adi11,
    As documented in the CVI Help under "Debugging DLLs": "In the LabWindows/CVI development environment, you can debug only DLLs you create in LabWindows/CVI with the Create Debuggable Dynamic Link Library command. Other development environments cannot debug DLLs you create in LabWindows/CVI."
    This information was also mentioned on the following discussion forum.
    Thanks.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

  • UnsatisfiedLinkError for JNI DLL compiled with vs2008 express

    I am trying to create a JNI DLL using Visual Studio 2008 Express.
    I have read several places where -MD causes JNI problems but from what I've read, I need this option to create the DLL properly.
    The DLL does get built cleanly and I have created a simple C application (obviously not calling the JNI functions themselves but the other functions that are in the DLL). This application runs with no problems.
    As soon as I try to use the DLL with JNI, I get an UnsatisfiedLinkError: Can't find dependent libraries.
    I have used Dependency Walker on the C application I created and it finds no errors; however, if I run it on the DLL itself, it does report an error trying to find msvcr90.dll which is in the winsxs directory under c:\windows so I assume this is the problem dependency.
    I am running this on the same computer that has Visual Studio 2008 Express SP1 installed. This is a Windows XP Service Pack 3 computer running JDK 1.6.0_14.
    Any help would be greatly appreciated.
    Thanks

    Right or wrong, I include some library files into my link statement (it's the only way I could find to clear up your question). I link in some standard window libraries as well as some of my own DLL whose functions are used by this DLL. I use a makefile to build my code.
    Here is a compile statement and the link statement for my DLL:
    cl.exe -I c:\progra~1\micros~1.0\vc\include -I c:\progra~1\mi2578~1\windows\v7.0\include -I c:/progra~1/java/jdk1.6.0_14/include -I c:/progra~1/java/jdk1.6.0_14/include/Win32 -I S:/wlw/Develop/Src/Include -I S:/wlw/Products/Src/Include -I S:/wlw/Products/Src/Include -I S:/wlw/Products/Src/LibSrc/RTA/Client/Include/Example -I S:/wlw/Products/Src/LibSrc/RTA/Client/Include/System -I S:/wlw/Products/Src/LibSrc/RTA/Client/Include/User -I S:/wlw/Products/Src/LibSrc/RTA/Server/Include/System -I S:/wlw/Products/Src/LibSrc/RTA/Server/Include/User -DRTA_DLL -D_BIND_TO_CURRENT_VCLIBS_VERSION -Zp4 -DWIN32 -D__WIN32__ -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 -D_USE_32BIT_TIME_T -D_CRT_SECURE_NO_WARNINGS -nologo -W3 -Od -EHsc -MD -Z7 -c buildDate.c
    link.exe -incremental:no -nologo -debug kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib -dll -out:S:/wlw/Products/Obj/Win32/Lib/rta.dll -implib:S:/wlw/Products/Obj/Win32/Lib/rta.lib eipc_client.obj eipc_usersys.obj eips_pccc.obj eips_cnxn.obj eips_cpf.obj eips_encap.obj eips_iomsg.obj eips_rtasys.obj eips_timer.obj rta_utils.obj eips_userdf1.obj eips_userobj.obj eips_usersock.obj eips_usersys.obj jniRta.obj jniRtaPlc.obj jniRtaPlcAddress.obj qcRta.obj qcRtaPlcAddressLink.obj qcRtaPlcLink.obj qcRtaProcess.obj qcRtaRead.obj qcRtaSlcRead.obj qcRtaSlcWrite.obj qcRtaState.obj qcRtaTimer.obj qcRtaWrite.obj Q:/Develop/Obj/Win32/Lib/tcpipNet.lib Q:/Develop/Obj/Win32/Lib/linkList.lib Q:/Develop/Obj/Win32/Lib/stdUtils.lib buildDate.obj
    mt -manifest S:/wlw/Products/Obj/Win32/Lib/rta.dll.manifest -outputresource:S:/wlw/Products/Obj/Win32/Lib/rta.dll;2

  • Call RFC with DLL created with DCOM CONNECTOR

    I try to call a RFC with a DLL that i created with the SAP R/3 DCOM CONNECTOR (Release 4.5.B):
    My external soft calls the DLL, which calls the RFC, which calls a transaction (Call Transaction Mode N, Update S)...
    When i test the RFC in SAP (SE37), it's OK.
    But when i call the RFC with my soft (and with the DLL), the Call Transaction returns sy-subrc = 1.001 (the methode "AdviseRfcGuiSink" included in the DLL allows me to launch the debugging with my external soft).
    I found no SAP notes about this problem.
    If you met the same problem, could you help me ?
    Thanks.
    Julien.

    Some Years later I have the same Problem.
    As discripet in the post before - first I've got an error in the Method "CreateNewRow()" where the Method wants to return "return new byte[]()". Well I don't know why the .Net-Connector creates that code - but it looks strange to me.
    The origin Code is:
        /// <summary>
        /// Creates an empty new row of type byte[].
        /// </summary>
        /// <returns>The newbyte[].</returns>
           public override object CreateNewRow()
                return new byte[]();;
    With Changing that method I've got the same Error as in the post before:
    System exception thrown while marshaling RFCTYPE_XMLDATAto .NET type.
    Does someone has found a solution for that kind of Problem?

  • Using DLLs created with LabWindows/CVI 8.0.0 in LabWindows/CVI 8.0.1

    Hi,
    I have created a project containing some methods with LabWindows/CVI 8.0.0 and then build the project and generated the DLL and LIB files. These DLL and LIB files are working fine in another projects created in LabWindows/CVI 8.0.0 (even on another machines).
    But when I use these DLL and LIB files in a project created with LabWindows/CVI 8.0.1 on another machine and try to call the methods of these files, the following error occurs: -
    "The program has caused a 'Unknown' fault at 001B:7C812AFB"
    Is this error occurs due to ther version mismatch or there is some other problem?
    Please help me to resolve this issue.
    Thanks,
    Sarabjit Singh

    Judging from this, I don't think NI has a newer version of this tool:
    http://forums.ni.com/t5/Measurement-Studio-for-VC/Convert-project-from-LabWindows-CVI-to-Visual-Stud...

  • Crystal Report Dll problem with Visual Studio 2005

    I am using Crystal Reports with Visual Studio 2005. At one time there were two different version of Crystal Decision Dll in Global Assembly Cache (GAC). So I uninstalled both the versions and then only installed 10.2.3600.
    I am facing the following error when building my application in visual studio.
    The type 'CrystalDecisions.CrystalReports.Engine.ReportDocument' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\arms website\301a5b02\e03ad7d9\assembly\dl3\c30f5560\00f92427_3857ca01\CrystalDecisions.CrystalReports.Engine.DLL'
    and
    'c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\10.2.3600.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll'
    I have only installed it in .Net Framework. For some reason it appears in the temp folder. I cannot delete it and when I renamed it after the next compile it came back again.
    I would appreciate any help.

    Thanks for the tip.
    I installed CR XI R2 with SP2 and 2.1
    There are few reports in the system they use to run fine but now when I try to run them I get the following error:
    Failed to open the connection. Details: [Database Vendor Code: 4060 ] Failed to open the connection. C:\DOCUME1\SSheikh\LOCALS1\Temp\ZGA370 {71BFCD35-F652-48C8-896D-B93229A4D2C2}.rpt Details: [Database Vendor Code: 4060 ]
    I understand that these reports run ok independently and on production machine as well; however when I try to run them from my development machine I get the above error.
    I would appreciate help to resolve this. The code of the report is with report developer and I need to know what settings do I need to change where to be able to run the reports. Also I use my machine for deployment of application on the production server.
    Thanks.

  • DLL created with LV 7.1 Application Builder doesn,t work when analysis subVIs are present

    I'm looking for a solution of the following problem.
    The DLL created by the "sum1.vi" source works properly, while the DLL create by "sum2.vi" always gives a zero result.
    The "sum2.vi" source contains an additional "Hanning Window" VI (not wired), that seems to be the cause of the problem.
    If I delete the Hanning VI and re-build the DLL, the same works fine
    Is there a solution or is it not possible to make Labview DLLs when containing analysis VIs as filters, windows, FFTs, and so on?
    Thank you for your answers.
    N. Roberto
    Attachments:
    sum1.vi ‏12 KB
    sum2.vi ‏14 KB

    Roberto N. wrote:
    Thank you Jordan, I'm using Labview 7.1.
    Anyway I've resolved the problem by adding the "lvanlys.dll" file (present in "..\Labview 7.1\resource\lvanlys.dll" path) as support file in the building process. Now the DLL containing the analysis functions works correctly.
    Natalino Roberto
    Ok, you probably got lucky since the lvanlys.dll seems to implement that function directly. However most Advanced Analysis functions are just redirected by lvanlys.dll to the Intel Math Kerneal Library that gets installed with LabVIEW 7.1 and higher. The only way to get that properly installed with your LabVIEW executable or DLL is to create a LabVIEW installer in your Application Builder and make sure to select under "Installer Settings->Advanced" the "LabVIEW Run-Time Engine" and the "Analyze VIs Support". Then use that installer to install your DLL on another computer.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Calling a dll created with vision 7.0 from visual basic doesn't work

    I created a dll using some vision 7.0 functions and Labview 7.0 environment. I call this dll from visual basic. The dll will work fine as long as I don't stop the visual basic program execution. As soon as I stop the program execution the dll will no longer work. I must reload the visual basic environment and the call to the dll will start working again. I created the exact same dll but I created it with vision 6.0 in Labview 6i environment. It works great and has no issues.
    Attachments:
    Test.vi ‏36 KB

    Roberto N. wrote:
    Thank you Jordan, I'm using Labview 7.1.
    Anyway I've resolved the problem by adding the "lvanlys.dll" file (present in "..\Labview 7.1\resource\lvanlys.dll" path) as support file in the building process. Now the DLL containing the analysis functions works correctly.
    Natalino Roberto
    Ok, you probably got lucky since the lvanlys.dll seems to implement that function directly. However most Advanced Analysis functions are just redirected by lvanlys.dll to the Intel Math Kerneal Library that gets installed with LabVIEW 7.1 and higher. The only way to get that properly installed with your LabVIEW executable or DLL is to create a LabVIEW installer in your Application Builder and make sure to select under "Installer Settings->Advanced" the "LabVIEW Run-Time Engine" and the "Analyze VIs Support". Then use that installer to install your DLL on another computer.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Dll created in visual studion with /CLR option won't load by cvi

    i have created a small dll, which holds 1 exported function.
    The dll is created in VisualStudio2008, sp1
    With option /CLR, targetting .NET framework 2.0
    The export is like below:
    extern "C"  int __declspec(dllexport) __stdcall testHelloWorld(void)
      System::Console::WriteLine("Hello world") ;
      System::Console::WriteLine("Hit the any key") ;
      System::Console::ReadKey() ;
      return 0 ;
    The following code should run this dll, from cvi 9.0.1 (375)
    extern int __stdcall testHelloWorld(void) ;
    typedef int (__stdcall * HelloWorldPtr) (void) ;
    void main(void)
    { HMODULE hLib = 0 ;
      HelloWorldPtr doit ;
      SetStdioPort (HOST_SYSTEM_STDIO);
      SetStdioWindowVisibility (1);
      hLib = LoadLibrary("CppTestClr.DLL")  ;
      (FARPROC)doit = GetProcAddress(hLib,"_testHelloWorld@0");
      doit() ;
    //  testHelloWorld();
    When i run the dll with run time linkage (as show above) there is no error, all ok.
    When i try to run the dll with load time linkage (line 'testHelloWordld' linked-in ),
    cvi shows an error 'A non-debuggable thread caused a general protection fault at address...'.
    This message is shown before the main function is reached.
    Visual studio has no problem in running the code from a win32 console application.
    Labview runs the code without problems.
    Why won't cvi load the dll ??
    tnx.

    nickb wrote:
    A solution will be available, but due to the complexity of this issue LabWindows/CVI 2010 will not work for you out of the box - a configuration will have to be made.  I've made a note to come back and update this post when LabWindows/CVI 2010 releases with instructions concerning this configuration.
    NickB
    National Instruments
    I'm an SSP member, so i'll receive the new version automatically.
    Maybe it's a good idea to also create an entry in the release notes of version 2010.
    These are my first attempts in using c++ dll's as a .NET wrapper for cvi.
    But it looks very promising. Comparing to the .NET wrappers in cvi it's much more convenient (native way of working).
    I would like to be able to use this as a generic way of working.

  • Can I use a dll created in Visual Basic 2010?

    I am reading up on the new extention system for air 3.0.
    I have successfully (I think) managed to integrate the Air 3.0 prerelease into Flash CS5.5 (I don't use flex or flash builder)
    So now I am trying to read up and learn how to use extentions.
    Now, I don't know C/C++. My experience with it has been very limited over the years. But I know visual basic pretty well as I have been using that since VB4. (back in the programming stone age, heh)
    Right now, I have Visual Studio 2010 and Flash CS5.5.
    I am developing for the iPhone and iPad and up until now I have created a working iOS application that works pretty well.
    Can I create a dll in visual basic (A class library) and then use the extention system to load that into my application to run on the iOS mobile device?

    I thought I'd seen this question asked somewhere before, but I can't find the thread. In theory there should be no problem. However, you'll need to have both the LabVIEW 5.1 and LabVIEW 8.6 run-time engines installed, and I don't know if there are any operating systems on which both of those versions are supported. If the run-time engine is properly installed, then calling a LabVIEW-built DLL is just like calling any other DLL. There might be some special optimization if the calling application and DLL both use the same version of the run-time engine.

  • How do we use Script (batch file with msbuild/msbuild project) to build Cordova Project created with Visual Studio Tools for Apache Cordova?

    I use Visual Studio to create Cordova projects. I need to build Cordova projects using msbuild and buildbot via script for my project but I can find only information about how VS combine with Cordova CLI to build multi device hybrid application.

    Hi Samseth,
    Yes, correct, the only thing we can find on the MSDN is:
    Deploy and Run Your App
    And that's the reason why Visual Studio Tools for Apache Cordova existing.
    I think you may get more detail compile information from here:
    http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • Legacy C program - new Java GUI and calling methods

    Hello, I am fairly new to these forums. I've been working for a company that has an exsisting program that is a propriotery video-client to a video-server. It is written in C and has DirectX components for the standalone C application and ActiveX com

  • Cell border with categories not possible?

    Several tables in my worksheet. Those without categories... I can format cell borders. Those with categories, no way. Can't select cell borders or apply line effects to a manually-selected cell border. Is there a workaround?

  • How do I send a 2 minute video ?

    What format should I use to send a 2 minute video over email?

  • Closing/ending a session in jsp

    Hi guys i need help ending my session. I am using session just for parameter passing, my webpages doesnt need login logout function. These are my basic code: page1.jsp <% String prodlinesel = request.getParameter("prod_line"); session.setAttribute( "

  • Illustrator CS6 DWG export also creates PNG/JPG Rasters?

    Why does Illustrator CS6 create a bunch of raster images (PNG or JPG) files when I export to DWG? There's no way to turn it off, is there? This is stupid.