CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: DLL exit

  1. #1
    Join Date
    May 1999
    Location
    TamilNadu, India
    Posts
    42

    DLL exit

    The native method implemented in C is a callback function... Upon some operation(Don't know when the operation will occur) it will call a function..... In that function I have to just close the application.... In that function I don't have env and object parameter.. Do any one know how to tackle this problem...
    Thanks lot,
    Srini.


  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: DLL exit

    If that application is in java, u can use 'System.exit(0);' call to close the application.

    - UnicMan
    http://members.tripod.com/unicman

  3. #3
    Join Date
    Sep 1999
    Location
    Houston, TX, USA
    Posts
    3

    Re: DLL exit

    Assuming your callback originates from C and you want to call back on the Java side, you can get hold of the JNIEnv pointer using the new GetEnv() function from Java2. GetEnv() is part of the JavaVM interface, a pointer of which is passed upon loading of the DLL to JNI_OnLoad(), an exported function Java2 will call if it exists. This JavaVM is unique and common to all threads, so can be safely cached in a static C variable. To access objects, either you have static Java method you can call that return them to you, or you cache them using NewGlobalRef(), but then there's threading issues. Read Sheng Liang's excellent book. Hope it helps, --DD


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured