JNI equivalent of a void * pointer

Hi I am writing a java wrapper for a method which returns a void * pointer. This void * pointer is then taken as input to all the other native methods I call subsequently. How should i be casting this void * pointer in Java , should it be an Object[]. Will the pointer get mangled or something while doing this cast ?

Cast it to a long.
Pass it to the other methods as a long and cast it back to a void*.
Since this is probably a allocated resource you should do the following
1. Provide a cleanup method. Call it Destroy or Close. It calls the appropriate JNI method that cleans it by calling another C/C++ method.
2. Create a finalizer which calls the cleanup method if the value has not yet been cleaned.

Similar Messages

  • Calling C function that has Void* pointer

    Hi
    I am trying to use some c functions in java using the JNI. This C function has 3 inputs, 2 integers and a void* pointer. I can import the 2 integers from java but dont know how to deal with the void* pointer.
    I would be greatful if someone could help me with this problem.
    Thanks
    Derek

    Hi,
    i guess the void * points to some C thingy. If you got
    the void * from C (via JNI), treat it as a long and cast it back in JNI
    as andyba suggested. If it is more than this (e.g. a C++ object)
    there is no general solution, but there are numerous special ones.
    If you tell a little more concrete what your void * points to,
    there might be more concrete suggestions.
    To get an idea, study e.g. swig's java module. But be warned,
    this is no simple topic.
    http://swig.sourceforge.net
    Have fun,
    Klaus

  • InputStream vs void pointer

    Hi All,
    In my C program I have one void pointer. I want to send this void pointer to my Java program as InputStream. Is it possible?
    Thanks,
    javadevlson

    In my C program I have one void pointer. I want to send this void pointer to my
    Java program as InputStream. Is it possible?Sure it is. You need a bit of JNI stuff to pass that void* back to Java as a byte[];
    given that array just use a ByteArrayInputStream.
    kind regards,
    Jos

  • Import CVI Instrument driver with void pointer

    Hi,
    I would like to use a CVI instrument driver that contains void pointers as parameters in LabVIEW. There are additional parameters which declare the kind of data where the void pointer points to.
    If I try to import this driver to LabVIEW I get warnings that the void pointer paarameters are converted to I32 since LabVIEW do not have the void pointer.
    Does anybody know if it is possible to import a CVI function with void pointers that will work properly in LabVIEW? How do I have to handle this converted void pointer?
    Thnaks,
    erik.

    Erik,
    you may have a look at this discussion forum thread.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • How do I pass a void *pointer to a dll in LabView

    I did read previous posts on the matter and tried just about everything, inlcuding defining the pointer as a U32 int.
    What I am trying to do is program FLASH using WindRiver VisionPROBE EST...
    I do have some sucesses... )
    I can open a connection to the EST, initialize it, start & stop the target. No problem here..
    Here are some additional details:
    I can't read memory, write to the target register or program the FLASH, yet. Any advice on how to get further with this? Typically, when doing this using WR's visionClick sw, we need to use a register file which sets up the target. I have not seen any reference to this in their API.
    I can convert to CVI if necessary. I am using the dll's from WindRi
    ver. I'd prefer keeping everything in LV, but LW-CVI is fine.
    My problem is that I am not sure if I am passing void pointers back & forth correctly. For instance, I need to call a function which returns a status, as follows:
    status = EST_WriteTargetRegister (long handle, Unsign int register, void * value)
    How do I pass the "void * value" to the input of a Call Library FUnction Node. I did try "Adapt to type" which does give a "void * value", and I tried both "Handles by Value" & "Pointers to Handles".
    When I change the input value to anything other than "Adpapt To Type", I get a violation error. >(
    Has anyone successfully automated WindRiver's EST?
    - Thanks -
    JLV"

    Hi,
    Have you tried passing a I32, but selecting "Pointer To Value"?
    Is there any description about the "void *pointer"? Could it be a callback
    function?
    Regards,
    Wiebe.
    "JoeLabView" wrote in message
    news:[email protected]..
    > I did read previous posts on the matter and tried just about
    > everything, inlcuding defining the pointer as a U32 int.
    >
    > What I am trying to do is program FLASH using WindRiver VisionPROBE
    > EST...
    >
    > I do have some sucesses... )
    > I can open a connection to the EST, initialize it, start & stop the
    > target. No problem here..
    >
    > Here are some additional details:
    >
    >
    >
    >
    > I can't read memory, write to the target register or program the
    > FLASH, yet. Any advice on how to get f
    urther with this? Typically,
    > when doing this using WR's visionClick sw, we need to use a register
    > file which sets up the target. I have not seen any reference to this
    > in their API.
    >
    > I can convert to CVI if necessary. I am using the dll's from
    > WindRiver. I'd prefer keeping everything in LV, but LW-CVI is fine.
    >
    > My problem is that I am not sure if I am passing void pointers back &
    > forth correctly. For instance, I need to call a function which
    > returns a status, as follows:
    >
    >
    > status = EST_WriteTargetRegister (long handle, Unsign int register,
    > void * value)
    >
    >
    > How do I pass the "void * value" to the input of a Call Library
    > FUnction Node. I did try "Adapt to type" which does give a "void *
    > value", and I tried both "Handles by Value" & "Pointers to Handles".
    >
    > When I change the input value to anything other than "Adpapt To Type",
    > I get a violation error. >(
    >
    > Has anyone successfully automated WindRiver's EST?
    >
    > - Thanks -
    >
    > JLV"

  • JNI equivalent of an unsigned char *

    Hi,
    I have a String in Java that needs to be passed to a predefined C library routine. The routine's signature is
    master(unsigned char *).
    How do I pass this string so that the routine can process it.I tried passing it as a jbyte array from java , the compilation and stuff does not fail but , my routine is returning an error because it is not able to read the data.
    Thanks in advance.

    I'm sorry , I'm not sure if I understand this correctly,
    if my method signature in my C file is
    JNIEXPORT jint JNICALL Java_reflexis_bac_validation_wrapper_Validate_MY_1FPI_1Master
    (JNIEnv * env, jobject methodObj, jlong instance, jbyteArray liveTemp, jbyteArray masterTemp, jobject xtraInfo){}
    where I have a jbyteArray type of variable. Now I need to pass this variable to a C method whose signature is
    int FPI_EXPORT FPI_Match( LPFPIINSTANCE lpInst,
                        USHORT wMatchingStrict,
                             UCHAR *lpLiveTemplate,
                             UCHAR *lpMaster,
                        LPFPI_MATCHINFO lpResults )
    So are you saying I have to convert the jbyteArray to an unsigned char string . How do I do that?

  • Pointer to void != pointer to function

    Hello C experts,
    this is a simple question about SunStudio's understanding of function pointers (it might have been asked before):
    Why is the following C code giving me a warning on all Sun compilers:
    # cat funcptr.c
    int main() {
        void (*func)() = (void*)0;
        return 0;
    # cc -c funcptr.c
    "funcptr.c", line 2: warning: assignment type mismatch:
         pointer to function() returning void "=" pointer to voidIs the warning emitted by Sun compiler a bug (over-cautions). Other compiler's don't warn here.
    Of course, I could use 0 or NULL as rvalue but I'm just wondering...
    Jochen

    Thanks everybody for your opinions.
    @Stephen:
    I wasn't aware that data pointers and function pointers may differ in any aspect. In fact, I only know data models that talk about 'pointer' width in general, like LP64 (64-bit wide long- and pointertypes), ILP32 (32-bit wide int-, long- and pointer-types), .. I'm especially surprised to hear that casting between data/function pointers will result in undefined behavior.
    Anyway, to properly 'fix' the code above, I must cast the zero to a function pointer (with matching signature) instead of a void pointer. This compiles w/o a warning:
        void (*func)() = (void (*)())0;Thanks for clarification.
    Jochen

  • Malloc() function in C -- returns void or character pointer?

    I've been learning about the free store and heap memory and what not, and I've got two books telling me two different things. One is telling me that the malloc() function returns a void pointer (note: this book has been wrong before) and the other is telling me that it always returns a character pointer. Which is correct? Thanks!

    Tron55555 wrote:
    when you say "if it's declared as returning a char pointer", are you referring to a theoretical scenario with a different compiler that has declared malloc as returning a char pointer instead of a void pointer? Do I have your meaning right?
    Yes. I think void* is standard, but I recall seeing it declared otherwise. The runtime library is written by programmers and a little time spent in this forum should convince you that programmers don't always agree on what's correct.
    This seems to be the case with Xcode, right?
    Yes. That's why I referred you to the manual page from the Darwin layer. The manual installed there should reflect the current version of gcc, which is the C compiler under Xcode. From the occasional unfortunate experience, we also know that "should" doesn't always equate to "is". But just use that manual and you'll do fine.
    Until I read about this in my other book, I never used casts with the malloc function and it always worked fine. Do you think it would be good programming practice for me to get used to writing the function with a cast in case I ever come across a compiler that requires it? I mean it couldn't hurt to write it that way right, even if I am using a compiler that declares malloc as returning a void pointer and doesn't require a cast?
    This is more a question of programming style. Type casts turn off the compiler's type checking. So in most cases, type casts are to be avoided. In the case of malloc, everyone knows the game, so an optional type cast depends on what you consider good style. The goal of all the style rules, from indenting to commenting, is to make it easy for someone else to read your code and understand it well enough to make a required change. So we ask ourselves, "What would I like to see 10 years from now when I won't even believe I wrote this stupid code?".
    \- Ray
    p.s.: Et's excellent point about byte alignment is a wonderful example of how a type cast can get you on the fast track to trouble. Casting a pointer returned from malloc is fine. But casting a pointer after it's been used could cause a problem. Byte alignment in this case means that an int can't start on an odd numbered memory location (I think it might need to be an address divisible by 4 on a 32-bit machine, but that's an Et question--especially as he's responsible for adding the subject of byte alignment to your thread). - R

  • JNI - Garbage Collector Problem ?

    Hi,
    I've got a JNI methode, which ceate and lauch a Process in c++ (a process to make VoIP).
    - this methode is returning an int=the pointer to the instance (which implement this process) so that othet JNI methode can have access to the main instance.
    Under windows, everything works fine, but
    Using linux:
    I add a memory wathcher on my program to see the memory used by the application / memory available for the JVM.
    The memory used by the application is growing (this is normal at this point), but when the GC is callled (by the system) the Java application is frozen (no error message), and I have to kill it. On the oter side, the Dll is running normally !
    My theory is that under Linux, the GC is "feeing" the memory used by the c++ process , then java is trying to write on it, but have no access, or somehing like that.
    Is there any option to be check this theory: as Java is retunring no error, but just freezing, it is not very clear to understand.
    I tried, using JNI, but removing the Process in it, just calling a basic operation, and there is no bug.
    Is there a special procedure to do on LINUX, for managing the Garbage Collector with JNI ?
    Here is a piece of code :
    /***********Java Side******************/
    //The JNI def:
    public class JNIWrapper {
         public JNIWrapper() {
         // create the h323 Process
    public native int create();
    ///The class managing the JNI methodes and containing the pointer to the dll main class
    public class CallControlH323 implements CallControl {
         int h323StackPtr; //Pointer to the h323stack, needed in the c++ side
         JNIWrapper myJNIWrapper;
         String options; //option for the CallControl configuration
         public CallControlH323(){
              myJNIWrapper = new JNIWrapper();
         public void configure(String options, String codecs) {
              h323StackPtr = myJNIWrapper.create();
    /*************************C++ side*****************/
    //JNI functions (file JNITerminal.cxx)
    #include "JNITerminal.h"
    #include <stdio.h>
    // Java Global Variables
    jobject jobj;
    JavaVM *jvm;
    /** Create the MainInterface **/
    JNIEXPORT jint JNICALL Java_ca_sess_voicesess_terminal_JNIWrapper_create
         (JNIEnv *env, jobject obj)
         // Make object a Global Reference
         jobj = env->NewGlobalRef(obj);
         // Get Java VM
         env->GetJavaVM(&jvm);
         //create and start the main Process
         MainInterface * mainInterface;
         mainInterface = new MainInterface();
         return ( ( jint ) mainInterface );
    MainInterface inherite from PProcess (from Pwlib), it is the top process of the dll application
    MainInterface::MainInterface():PProcess("", "", MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
    #ifdef MSCVER
    #pragma warning(disable:4355)
    #endif
    #ifdef MSCVER
    #pragma warning(default:4355)
    #endif
         ShowOutputs("H323Lib: Create Main Interface");
    void MainInterface::Main () {}
    MainInterface::~MainInterface()
    /////////////////////////////////////////////////////////////////////////7
    If you have any suggestion, comment, help, don hesitate !!
    Thanks for your help
    Bart

    I also added the option -verbosegc to the java command.
    I noticed that the bug arrived after a Full gc:
    [Full GC 23301K->12351K(24844K), 0.3737040 secs]

  • Error in Java Runtime Environment when running JNI native library

    Hi,
    I am kinda new to JNI but understand it [and done some tutorials]. I am trying to implement JavaStyle [ a Java vst host that uses JNI ] and have reached a point where i successfully build the native code to a dll, and almost manage to load the native dll library. I do not get a Unsatisfied Link Error, but instead have the JVM close due an internal error.
    I am completely lost and dont know what to try now, and I would appreciate any help offered.
    I have debugged and the error arrives at the System.load line of code:
      static {
        System.out.print("Pre loadLibrary..."); 
        System.loadLibrary("JaVaSTyle");
        System.out.println("JavaStyle dll loaded in JVSTLibrary");
      }Detail: I compiled the native library with MS visual studio .NET 2003 using the project settings supplied from the CVS repository.
    I use Netbeans 6.0 for the java side of things. The console output is:
    # An unexpected error has been detected by Java Runtime Environment:
    #  Internal Error (0xe0434f4d), pid=1500, tid=6012
    # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
    # Problematic frame:
    # C  [kernel32.dll+0x12a5b]
    # An error report file with more information is saved as hs_err_pid1500.logand the error report is :
    # An unexpected error has been detected by Java Runtime Environment:
    #  Internal Error (0xe0434f4d), pid=1500, tid=6012
    # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
    # Problematic frame:
    # C  [kernel32.dll+0x12a5b]
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    ---------------  T H R E A D  ---------------
    Current thread (0x00297000):  JavaThread "main" [_thread_in_native, id=6012]
    siginfo: ExceptionCode=0xe0434f4d
    Registers:
    EAX=0x0090f4c0, EBX=0x00000001, ECX=0x000b0fd0, EDX=0x00000000
    ESP=0x0090f4bc, EBP=0x0090f510, ESI=0x00000000, EDI=0x00000000
    EIP=0x7c812a5b, EFLAGS=0x00000246
    Top of Stack: (sp=0x0090f4bc)
    0x0090f4bc:   000b0fd0 e0434f4d 00000001 00000000
    0x0090f4cc:   7c812a5b 00000000 791b9d02 02ea1198
    0x0090f4dc:   07624998 000b0fd0 0090f4fc 791be271
    0x0090f4ec:   000ae008 00000002 07624998 00000000
    0x0090f4fc:   0090f50c 791be286 000ae008 07624998
    0x0090f50c:   0090f51c 0090f568 7921020d e0434f4d
    0x0090f51c:   00000001 00000000 00000000 000b0fd0
    0x0090f52c:   0090f578 00000001 7c812a5b 0090f1f0
    Instructions: (pc=0x7c812a5b)
    0x7c812a4b:   8d 7d c4 f3 a5 5f 8d 45 b0 50 ff 15 08 15 80 7c
    0x7c812a5b:   5e c9 c2 10 00 85 ff 0f 8e 36 93 ff ff 8b 55 fc
    Stack: [0x008c0000,0x00910000),  sp=0x0090f4bc,  free space=317k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C  [kernel32.dll+0x12a5b]
    C  [mscorwks.dll+0x6020d]
    C  [mscorwks.dll+0x60190]
    C  [mscorwks.dll+0x60144]
    C  [mscorwks.dll+0xa6dcb]
    C  [mscorwks.dll+0x26a7e]
    C  0x000b15f6
    j  java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;)V+0
    j  java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+300
    j  java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+268
    j  java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String;)V+54
    j  java.lang.System.loadLibrary(Ljava/lang/String;)V+7
    j  org.tango.JaVaSTyle.JVSTLibrary.<clinit>()V+10
    v  ~StubRoutines::call_stub
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;)V+0
    j  java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+300
    j  java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+268
    j  java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String;)V+54
    j  java.lang.System.loadLibrary(Ljava/lang/String;)V+7
    j  org.tango.JaVaSTyle.JVSTLibrary.<clinit>()V+10
    v  ~StubRoutines::call_stub
    j  org.tango.JaVaSTyle.Main.main([Ljava/lang/String;)V+3
    v  ~StubRoutines::call_stub
    ---------------  P R O C E S S  ---------------
    Java Threads: ( => current thread )
      0x02a6d800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4752]
      0x02a68c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4472]
      0x02a67800 JavaThread "Attach Listener" daemon [_thread_blocked, id=2016]
      0x02a66c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4328]
      0x02a62400 JavaThread "Finalizer" daemon [_thread_blocked, id=5072]
      0x02a5dc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=5552]
    =>0x00297000 JavaThread "main" [_thread_in_native, id=6012]
    Other Threads:
      0x02a5cc00 VMThread [id=4660]
      0x02a6f000 WatcherThread [id=3864]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation   total 960K, used 199K [0x22970000, 0x22a70000, 0x22e50000)
      eden space 896K,  22% used [0x22970000, 0x229a1ff0, 0x22a50000)
      from space 64K,   0% used [0x22a50000, 0x22a50000, 0x22a60000)
      to   space 64K,   0% used [0x22a60000, 0x22a60000, 0x22a70000)
    tenured generation   total 4096K, used 0K [0x22e50000, 0x23250000, 0x26970000)
       the space 4096K,   0% used [0x22e50000, 0x22e50000, 0x22e50200, 0x23250000)
    compacting perm gen  total 12288K, used 23K [0x26970000, 0x27570000, 0x2a970000)
       the space 12288K,   0% used [0x26970000, 0x26975c48, 0x26975e00, 0x27570000)
        ro space 8192K,  66% used [0x2a970000, 0x2aebf860, 0x2aebfa00, 0x2b170000)
        rw space 12288K,  52% used [0x2b170000, 0x2b7bf078, 0x2b7bf200, 0x2bd70000)
    Dynamic libraries:
    0x00400000 - 0x00423000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\java.exe
    0x7c900000 - 0x7c9b0000      C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f5000      C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000      C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f02000      C:\WINDOWS\system32\RPCRT4.dll
    0x77fe0000 - 0x77ff1000      C:\WINDOWS\system32\Secur32.dll
    0x7c340000 - 0x7c396000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\msvcr71.dll
    0x6d870000 - 0x6daba000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\client\jvm.dll
    0x7e410000 - 0x7e4a0000      C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000      C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000      C:\WINDOWS\system32\WINMM.dll
    0x76390000 - 0x763ad000      C:\WINDOWS\system32\IMM32.DLL
    0x5cd70000 - 0x5cd77000      C:\WINDOWS\system32\serwvdrv.dll
    0x5b0a0000 - 0x5b0a7000      C:\WINDOWS\system32\umdmxfrm.dll
    0x003a0000 - 0x003ad000      C:\WINDOWS\system32\myokent.dll
    0x6d3c0000 - 0x6d3c8000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000      C:\WINDOWS\system32\PSAPI.DLL
    0x6d820000 - 0x6d82c000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\verify.dll
    0x6d460000 - 0x6d47f000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\java.dll
    0x6d860000 - 0x6d86f000      C:\Program Files\Java\jdk1.6.0_03\jre\bin\zip.dll
    0x10000000 - 0x10018000      D:\NetbeansWorkspace\myJavaStyle\JaVaSTyle.dll
    0x79170000 - 0x79196000      C:\WINDOWS\system32\mscoree.dll
    0x10480000 - 0x1053c000      C:\WINDOWS\system32\MSVCP71D.dll
    0x10200000 - 0x10287000      C:\WINDOWS\system32\MSVCR71D.dll
    0x77f60000 - 0x77fd6000      C:\WINDOWS\system32\SHLWAPI.dll
    0x77c10000 - 0x77c68000      C:\WINDOWS\system32\msvcrt.dll
    0x791b0000 - 0x79412000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll
    0x79040000 - 0x79085000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
    0x7c9c0000 - 0x7d1d6000      C:\WINDOWS\system32\SHELL32.dll
    0x773d0000 - 0x774d3000      C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
    0x5d090000 - 0x5d12a000      C:\WINDOWS\system32\comctl32.dll
    0x79780000 - 0x79980000      c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll
    0x774e0000 - 0x7761d000      C:\WINDOWS\system32\ole32.dll
    0x79430000 - 0x7947c000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\MSCORJIT.DLL
    0x51a70000 - 0x51af0000      C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\diasymreader.dll
    VM Arguments:
    java_command: org.tango.JaVaSTyle.Main
    Launcher Type: SUN_STANDARD
    Environment Variables:
    CLASSPATH=.;C:\jdk1.5.0_09\bin;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
    PATH=C:\Program Files\MiKTeX 2.7\miktex\bin;c:\program files\imagemagick-6.3.7-q16;C:\texmf\miktex\bin;C:\Program Files\ActiveState Komodo IDE 4.2\;C:\Program Files\Autodesk\Maya2008\bin;C:\Python25\;C:\Program Files\PC Connectivity Solution\;C:\ORANT\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\GPS Pathfinder Office 3.00;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\ENGLISH;C:\Program Files\Common Files\Motorola\Toolbox;C:\PROGRA~1\COMMON~1\Motorola\Toolbox;C:\Program Files\Novell\ZENworks\;C:\Program Files\Novell\SecureLogin;C:\Program Files\Smart Projects\IsoBuster;C:\Latex\MikTeX\V2.10;C:\PROGRA~1\CA\Common\SCANEN~1;C:\Program Files\CA\Common\ScanEngine;C:\Program Files\CA\SharedComponents\CAUpdate\;C:\Program Files\CA\SharedComponents\ThirdParty\;C:\Program Files\CA\SharedComponents\SubscriptionLicense\;C:\PROGRA~1\CA\ETRUST~1;C:\Program Files\QuickTime\QTSystem\;C:\cygwin\bin;C:\Program Files\Tcl\bin;D:\netbeansWorkspace\myJavaStyle;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\Csound\bin;C:\Program Files\CVSNT\
    USERNAME=hectorj
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 8, GenuineIntel
    ---------------  S Y S T E M  ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 13 stepping 8, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 1047920k(270244k free), swap 2520456k(1654520k free)
    vm_info: Java HotSpot(TM) Client VM (1.6.0_03-b05) for windows-x86, built on Sep 24 2007 22:24:33 by "java_re" with unknown MS VC++:1310

    Something is wrong with the library.
    Staring at java code will not help you figure that out.
    Maybe it isn't intended to be loaded in java but instead it loads java itself?
    If not then write a C/C++ basic app that links that dll in and see if you can at least get it to start.

  • Setting white point in LR

    I'm almost sure I'm missing something but I cannot find a solution. I'm using LR (currently 2.2) for quite a while (since 1.2) but I simply cannot find an easy, user friedly and predictable way how to set a white point of edited pictures.
    In PS, CR, DPP and most other editing SW and RAW processors, there two typical easy tools how to set the white point.
    1) a white point picker which (when used) defines a desired tone as white and the relevant SW then redistributes the tones accordingly;
    2) in "levels" or "curves" dialog (or their equivalents it is possible to move the "White level" treshold below which the remaining tones are redistributed accordingly - the iterface varies (sometimes it is the border of the histogram or curve diagram that can be moved (DPP), sometimes it is the slider in histogram or curve diagram setting this limit
    botw ways generally lead to the same and quite uniform result. I.e. I'm usually able to get almost identical result by setting white point in PS, DPP, CR, .... and other SW by such simple operation when working over identical picture data.
    However in LR it is virtually impossible to achieve similar result in LR. No white point picker, no slider enabling setting the white limit, no chance to move borders in the histogram chart. The only available tools for this purpose are
    "Exposure" and "Brightness". None of them providing for the desired functionality alone - their combination giving sometimes acceptable but hardly predictable results (definitely not as predictable as achieved e.g. in PS by simple and single move of white limit slider in "level" dialogue or equivalent step in CR.
    Do I really miss something important (I hope so) in this respect or is LR completly lacking this (for me really core/basic) functionality present in all other photo and RAW editting SW I know - even from Adobe?
    thanks

    I agree with the original poster - I find it troublesome to set the white point in an image. In a situation where a traditional (PS, Aperture) levels control would make it convenient to push a particular tone to white, I find myself going back and forth between exposure and the tone curve a fair amount. Another description of what I want, effectively, is a 'recovery' slider that goes up as well as down.
    (See end of post for replies to a few specific points.)
    An example:
    Here is the original image, with its histogram and tone curve - black to middle gray:
    I want to push the small hatch/door to white, but that also overexposes my middle grays (I haven't yet touched the tone curve):
    So now I go to the tone curve, and pull down both darks and lights:
    However, at this point I've lost my whites (they are not quite clipped any more); and probably more importantly, since the tone curve is at the extreme low values, I have little working room or control.
    Rather than working together or providing complementary functions, in this case exposure and the tone curve, to me, seem to be fighting; it requires back-and-forth to get the desired effect.
    (To be clear, most of the time - that is, when my white point starts out more or less where I want it - being able to drag the histogram and smoothly-transitioned segments of the tone curve is brilliantly easy and useful. It's specifically the exposure control's nonlinear behavior/effect that I dislike, as it makes it difficult to adjust near-white tones.)
    Responding to specifics:
    > Also, hold the ALT key (David Edwards)
    Cool! (However, not a fix for this issue.)
    > the controls themselves are not linear (Lee Jay)
    > attempts to preserve highlights (Lee Jay)
    > the exposure slider is almost exactly equivalent to the white point slider in Photoshop's levels/curves (Joa V. L.)
    I think this is the root of the issue, for me - the exposure control is being intelligent in a way to protect hilights, which is counter to my intent. My experience leads me to disagree strongly with Joa's comment (though I would be very happy to discover I was wrong) - my problem is specifically that adjusting exposure up (brightening the image with exposure) affects tones less, the brighter they are.
    > I need to decrease the Brightness (Henry_Deer)
    > you may need to generate a higher-contrast tone curve and work with that (Lee Jay)
    The brightness adjustment seems analogous to my use of the tone curve, though it's an alternate approach I haven't tried. However, both seem to suffer from the 'several rounds' problem.
    Edited to reply to a few specific points

  • Creating Type void

    cpsSend( const void* Message, Const int
    BCount)
    I have created the VI for the above function. I am having problem finding the right pallate that will make "Const Void* Message" when i am in the
    -Build Application or shared library
    - Define VI Prototype(function Prototype)
    I have tried to use the variant function in my VI but i am not getting "const void". Also is there a way to have a parameter of type int instead of a long, short or etc. I change the properties to the controls/indicators to u32, I32 and etc. If you can direct me to a tutorial or the instruction on how to implement this i would really appreciate. Thanks for your time.

    The const keyword is only a hint to a C compiler that the function is not modifying the buffer past in in any way. This allows a C compiler to do some optimizations in certain circumstances when calling such a function and when compiling the function any well behaved compiler should complain if you modify this pointer inside the function or pass it to a function which is not itself declared to treat this pointer as const. For LabVIEWs Call Library Node you can fully ignore this keyword.
    The void* pointer is a C syntax for a pointer which can potentially point to any datatype. In LabVIEW you will have to find out what the datatype is, this pointer should point at. It could be a byte, short, integer, long, or floating point value or an array of them or maybe also a string and configure the Call Library Node accordingly. LabVIEW is a strict datatype language and does not really allow for ambigues datatypes such as void* do present. This is no problem as the function in question will expect some specific datatype anyhow, possibly depending on a second parameter which defines what datatype the void* parameter should be treated as in this case.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Creating JVM to Make JNI calls

    I am trying to create a JVM to make JNI calls to Java. When I try to link my C++ program with jvm.lib, I am getting following error. Please advise.
    "fatal error LNK1106: invalid file or disk full"
    I am sure the disk is not full.

    What IDE are you using? I am using MS VC++ 5.0 with jdk 1.3 and I got the same error. After trying several things (including recreating my project)I realized that jdk 1.3 was created after VC++ 5.0. So on a wild hunch I installed jdk 1.2.2. I then removed all project referrences to jdk 1.3. Closed all my files. Reopend them. Made sure the jni.h external dependency was pointing to 1.2.2 (you may have to do a build to force it) and then everything linked fine.

  • [SOLVED]C pointer question

    I'm having a terrible time tracking down what exactly the issue is here in my code.  To me, at first it seemed like a simple missed assignment, but after tinkering in gdb I realize there is something deeper going on here that I don't understand. 
    Here is the local function in which the problem occurs.
    static void
    CountryStorageinsert(void *self, void *data){
    if (self = 0)
    return;
    CountryStorage *rs = (CountryStorage *) self;
    Record *r = (Record *) data;
    rs->countries[r->id] = r;
    if (r->id > rs->maxid)
    rs->maxid = r->id;
    rs->nrecords++;
    The issue is that no matter what the value the void *self is passed in with, the assignment to *rs is ALWAYS zero.  Additionally in my project there are three such functions, CountryStorageinit, CountryStorageinsert, CountryStoragebackup which all have similar constructs all have the same problem.  I can not seem to pass in a void pointer and cast it to a compound structure pointer.
    What is even more puzzling is I can manually, in gdb, get the behaviour I originally expected this code to have.  That is I can "(gdb) set rs = (CountryStorage *) self" and then examine rs, and vioala it has the address that self contained in the function parameters.
    I would really appreciate it if someone could tell me if my thoughts on how pointer coercion works are wrong.
    Thanks.
    Last edited by ickabob (2011-10-23 17:55:11)

    Classic C mistake;
    if (self = 0)
    as opposed to
    if (self == 0)

  • Please Help again !!! Return statements and references in JNI !!!

    hi,
    if somebody could help me again or have just a hint i am very thankful.
    let us examine i have the following simple c/c++-code for rectangular integration:
    JNIEXPORT void JNICALL
    Java_ValueList_callg1(JNIEnv *env, jobject obj)
    alpha[indx][temp]=-10*log10(integrate_rect(uk, ok, -aey/2., aey/2., sigmax, sigmay, 500, 500)this code calls the function integrate rect for a two dimensional rectangular integration and normally returns the double value temp to the function caller:
    double integrate_rect(double rectxmin, double rectxmax, double rectymin, double rectymax, double sigmax, double sigmay, int xsteps, int ysteps)
         //cout<<"You are using trapezoid integration method !!!"<<endl;
         double xmin=trapxmin;
         double xmax=trapxmax;
         double ymin=trapymin;
         double ymax=trapymax;
         //declare number of trapezoids in x and y directions
         int m=xsteps;     //x direction
         int n=ysteps;     //y direction
         //declare steps in x and y directions
         double hx=(xmax-xmin)/m;
         double hy=(ymax-ymin)/n;
         double temp = 0.;
         double y=ymin;
                   for (int indy = 0; indy < n; indy++)
                        {     //count y-steps
                             double x=xmin;
                                       for (int indx = 0; indx < m; indx++)
                                            {     //count x-steps
                                                  /*add for every x,y loop the previous temp to the actual temp
                                                   distance in x and y directions has to be added to every 'partial' function*/
                                                   /**temp += (1./4.*hx*hy*(f(x, y, sigmax, sigmay) + f(x+hx, y, sigmax, sigmay) + f(x, y+hy, sigmax, sigmay) + f(x+hx, y+hy, sigmax, sigmay)));
                                                   x+=hx;
                                            }     //end x direction
                                       y+=hy;
                        }     //end y direction
                   return temp;     //return value to the function caller
    }     //end of trapeziod integration     examine using JNI now: the integrate function returns type of double the JNI method "return" is void....so i do not want any value come back to java.
    I want the value to reside in native code without passing the value outside native code and in again !!! Is this possible ???
    Another question here is how to handle with references?? If i understand correct in JNI tutorial you have to create global references to prevent the "temp" value in integrate function beeing garbage collected.
    I get stuck here because i did not find anything about multiple methods residing in native code.
    e.g.
    //rectangular integration
    double integrate_rect(....)
    return temp;
    //integration through gsl library
    double integrate_gsl(....)
    return result:I want to return the result to the function caller on NOT to java.
    Is it really the only solution to pass the value back to java and then to another native method again (which would result in multiple loops from java to native, to java and native back again....) or is there a trick how i can return a value to the function caller.
    Please give me a hint on this.
    regards

    examine using JNI now: the integrate function returns
    type of double the JNI method "return" is void....so
    i do not want any value come back to java.
    I want the value to reside in native code without
    passing the value outside native code and in again
    !!! Is this possible ???Yes. This is a C/C++ question however. The answer lies there - use a global variable.

Maybe you are looking for