Problem calling native functions

Ok, I generate a dll with some native functions, but when I want to use one of the native functions I get the error:
java.lang.UnsatisfiedLinkError: pruebas.TestClass.myFunction(II)I
where pruebas.TestClass is the class that class the native function myFunction(int, int)...
I get the same error when I do not load the dll, can somebody help me solve this error
thanks a lot
God bless you
--Chema                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

hmm, never done this on windows so I can't be too sure. You can try setting java.library.path and see if it helps.
http://www.inonit.com/cygwin/jni/helloWorld/load.html
(the command wopuld be java -Djava.library.path=YOURPATH yourapplication)

Similar Messages

  • Call native function fflush & strprn from java

    Hi,
    I need to call a native function fflush and stdprn from java for printing a file.
    How can i call this function?
    Can any one help me with sample code.
    Thanks,
    rpalanivelu

    Thanks your reply,
    Actually my problem is need to take printout using dot matrix printer(text printer) with different font size.
    So, i am using native method which is available in c.
    in c program i am using fflush,stdprn and fprintf.
    Here i've attached my sample program also.
    #include <jni.h>
    #include "NativePrint.h"
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #define MAXLINE_LEN 100
    JNIEXPORT jint JNICALL
    Java_NativePrint_dotMatrixPrint(JNIEnv* env, jobject obj )
    FILE *fp;
    char filename[20];
    char line[100]; /* A line read from the file */
    int lineNumber = 0;
    /* Print control codes */
    char boldOn = 14;
    char boldOff = 20;
    char contentlenOn = 15;
    char contentlenOff = 18;
    printf("Printing from C3");
    strcpy( filename , "sayHello.c" );
    /* Open the file in read mode */
    fp = fopen( filename , "r" );
    /* Error in opening file, then exit */
    if ( fp == NULL )
    printf( "\nERROR: %s cannot be opened\n" , filename );
    exit( 1 );
    while ( fgets( line , 100 , fp ) != NULL )
    lineNumber++; /* Line we are about to process next */
    printf("%s",line);
    /* If this is the first line */
    if ( lineNumber == 1 )
    /* then print it in bold */
    //fprintf( stdprn , "%c" , boldOn );
    fprintf( stdprn , "%c" , contentlenOn );
    fprintf( stdprn , line );
    fprintf( stdprn , "%c" , contentlenOff);
    //fprintf( stdprn , "%c" , boldOff );
    else
    /* else print it in normal mode */
    fprintf( stdprn , line );
    fflush(stdprn);
    return 0;

  • Problems calling virtual functions

    Hi,
         We have code running in a shared library that appears to be incorrectly changing registers that contain function parameters before the called (virtual) function acceses the registers containing its parameters.
    Has anyone seen a similar problem ? If so does
    anyone knaw what the solution is ?
    Compiler:
    SunAMD:tbucken@win64bld 247>>> CC -V
    CC: Sun C++ 5.7 2005/01/07
    SunAMD:tbucken@win64bld 248>>> uname -a
    SunOS win64bld 5.10 Generic i86pc i386 i86pc
    solaris is running on an HP DL585 (4 cpu's)
    calling function code (We are setting up a vitual function call):
         tempdatabase->CostModel->GetCompareSelectivity
         (_lhs_base, rhsbase, rhsconverted, op, &sel_est,
         &_value_distrib );
    / Line 922
         movq     -144(%rbp), %r8
         movq     352(%r8), %r8
         movq     0(%r8), %r14
         movq     -144(%rbp), %r13
         movq     -8(%rbp), %r12
         movq     -8(%rbp), %r11
         movq     -8(%rbp), %r10
         movq     -8(%rbp), %r8
         movzbl     120(%r8), %eax
         movq     -8(%rbp), %r9
         movq     -8(%rbp), %r8
         leaq     192(%r8), %r8
         movq     %r8, 0(%rsp)
         leaq     40(%r9), %r9
         movl     %eax, %r8d
         movq     168(%r10), %rcx
         movq     152(%r11), %rdx
         movq     144(%r12), %rsi
         movq     352(%r13), %rdi
         movq     48(%r14), %r10
         movl     $0, %eax
         call     *%r10
    the function called:
    p_expr is a pointer:
    a_relation is an unsigned char
    The last 2 arguments are pointers.
    void CostModel::GetCompareSelectivity(
    p_expr                colexpr,
                        p_expr                expr2,
                        p_expr                expr2_converted,
                        a_relation           reln,
                        SelectivityEstimate      *est,
                        IHistogram          **hist )
    My uderstading of register usage during a function call on opteron (from
    http://www.x86-64.org/documentation/abi-0.96.pdf)
    %rdi - first argument - this pointer
    %rsi - second argument - colexpr
    %rdx - third argument - expr2
    %rcx - fourth argument - expr2_converted
    %r8 - fifth argument - reln
    %r9 - sixth argument - est
         %rcx and %r8 are being setup correctly by the calling function but they are changed by the code that is executed by the call psudo-op that
    calculates that virtual function address.
    setting up the function call
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at line 922 in file "dfp_compares.cpp"
    922 tempdatabase->CostModel->GetCompareSelectivity
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcbd
    0xfffffd7ffe85dcbd: ComputeSelectivity+0x038d: movq 0x0000000000000160(%r8),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcc4
    0xfffffd7ffe85dcc4: ComputeSelectivity+0x0394: movq 0x0000000000000000(%r8),%r14
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcc8
    0xfffffd7ffe85dcc8: ComputeSelectivity+0x0398: movq 0xffffffffffffff70(%rbp),%r13
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dccf
    0xfffffd7ffe85dccf: ComputeSelectivity+0x039f: movq 0xfffffffffffffff8(%rbp),%r12
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcd3
    0xfffffd7ffe85dcd3: ComputeSelectivity+0x03a3: movq 0xfffffffffffffff8(%rbp),%r11
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcd7
    0xfffffd7ffe85dcd7: ComputeSelectivity+0x03a7: movq 0xfffffffffffffff8(%rbp),%r10
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcdb
    0xfffffd7ffe85dcdb: ComputeSelectivity+0x03ab: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcdf
    0xfffffd7ffe85dcdf: ComputeSelectivity+0x03af: movzbl 0x0000000000000078(%r8),%eax
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dce4
    0xfffffd7ffe85dce4: ComputeSelectivity+0x03b4: movq 0xfffffffffffffff8(%rbp),%r9
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dce8
    0xfffffd7ffe85dce8: ComputeSelectivity+0x03b8: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcec
    0xfffffd7ffe85dcec: ComputeSelectivity+0x03bc: leaq 0x00000000000000c0(%r8),%r8
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcf3
    0xfffffd7ffe85dcf3: ComputeSelectivity+0x03c3: movq %r8,0x0000000000000000(%rsp)
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcf8
    0xfffffd7ffe85dcf8: ComputeSelectivity+0x03c8: leaq 0x0000000000000028(%r9),%r9
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcfc
    0xfffffd7ffe85dcfc: ComputeSelectivity+0x03cc: movl %eax,%r8d
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dcff
    0xfffffd7ffe85dcff: ComputeSelectivity+0x03cf: movq 0x00000000000000a8(%r10),%rcx
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd06
    0xfffffd7ffe85dd06: ComputeSelectivity+0x03d6: movq 0x0000000000000098(%r11),%rdx
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd0d
    0xfffffd7ffe85dd0d: ComputeSelectivity+0x03dd: movq 0x0000000000000090(%r12),%rsi
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd15
    0xfffffd7ffe85dd15: ComputeSelectivity+0x03e5: movq 0x0000000000000160(%r13),%rdi
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd1c
    0xfffffd7ffe85dd1c: ComputeSelectivity+0x03ec: movq 0x0000000000000030(%r14),%r10
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd20
    0xfffffd7ffe85dd20: ComputeSelectivity+0x03f0: movl $0x0000000000000000,%eax
    t@7 stepi
    t@7 (l@7) stopped in dfp_Compares::ComputeSelectivity at 0xfffffd7ffe85dd25
    0xfffffd7ffe85dd25: ComputeSelectivity+0x03f5: call *%r10d
    t@7 regs
    current frame: [1]
    r15 0x0000000000000000
    r14 0xfffffd7ffee61d60
    r13 0xfffffd7fed3f3890
    r12 0xfffffd7fed4573c0
    r11 0xfffffd7fed4573c0
    r10 0xfffffd7ffeaa3b20
    r9 0xfffffd7fed4573e8
    r8 0x0000000000000002
    rdi 0xfffffd7fed3ff1a8
    rsi 0x0000000000000000
    rbp 0xfffffd7ffdbfa730
    rbx 0xfffffd7ffdee1400
    rdx 0x0000000000000000
    rcx 0x0000000000000000
    rax 0x0000000000000000
    trapno 0x0000000000000001
    err 0x0000000000000000
    rip 0xfffffd7ffe85dd25:ComputeSelectivity+0x3f5 call *%r10d
    cs 0x000000000000004b
    eflags 0x0000000000000286
    rsp 0xfffffd7ffdbfa600
    ss 0x0000000000000043
    fs 0x00000000000001bb
    gs 0x0000000000000000
    es 0x0000000000000000
    ds 0x0000000000000000
    fsbase 0xfffffd7ffdee1400
    gsbase 0xffffffff80000000
    t@7
    %rcx contains 0 which is the correct value for expr2_converted
    %r8 contains 2 which is the correct value for reln
    step through the code generated by the call psudo-op
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b20
    0xfffffd7ffeaa3b20: __SLIP.THUNK__E : pushq %rbp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b21
    0xfffffd7ffeaa3b21: __SLIP.THUNK__E+0x0001: movq %rsp,%rbp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b24
    0xfffffd7ffeaa3b24: __SLIP.THUNK__E+0x0004: subq $0x0000000000000010,%rsp
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b28
    0xfffffd7ffeaa3b28: __SLIP.THUNK__E+0x0008: movq %rdi,0xfffffffffffffff8(%rbp)
    t@7 stepi
    %r8 is changed here:
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b2c
    0xfffffd7ffeaa3b2c: __SLIP.THUNK__E+0x000c: movq 0xfffffffffffffff8(%rbp),%r8
    t@7 p -fx $r8
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $r8 = 0x2
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b30
    0xfffffd7ffeaa3b30: __SLIP.THUNK__E+0x0010: leaq 0xfffffffffffffff8(%r8),%r8
    t@7 p -fx $r8
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $r8 = 0xfffffd7fed3ff1a8
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b34
    0xfffffd7ffeaa3b34: __SLIP.THUNK__E+0x0014: movq %r8,0xfffffffffffffff8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b38
    0xfffffd7ffeaa3b38: __SLIP.THUNK__E+0x0018: movq 0xfffffffffffffff8(%rbp),%rdi
    t@7 stepi
    %rcx is chaged here:
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b3c
    0xfffffd7ffeaa3b3c: __SLIP.THUNK__E+0x001c: movq 0x000000000035d08d [ 0x35d08d ],%rcx
    t@7 p -fx $rcx
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $rcx = 0x0
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b43
    0xfffffd7ffeaa3b43: __SLIP.THUNK__E+0x0023: leave
    t@7 p -fx $rcx
    dbx: warning: The format '0x%x' is not suitable for type long long, will use 'llx' instead
    $rcx = 0xfffffd7ffeaa8aa0
    t@7 stepi
    t@7 (l@7) stopped in __SLIP.THUNK__E at 0xfffffd7ffeaa3b44
    0xfffffd7ffeaa3b44: __SLIP.THUNK__E+0x0024: jmp *%ecx
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa0
    0xfffffd7ffeaa8aa0: GetCompareSelectivity : pushq %rbp
    t@7 regs
    current thread: t@7
    current frame: [1]
    r15 0x0000000000000000
    r14 0xfffffd7ffee61d60
    r13 0xfffffd7fed3f3890
    r12 0xfffffd7fed4573c0
    r11 0xfffffd7fed4573c0
    r10 0xfffffd7ffeaa3b20
    r9 0xfffffd7fed4573e8
    r8 0xfffffd7fed3ff1a0
    rdi 0xfffffd7fed3ff1a0
    rsi 0x0000000000000000
    rbp 0xfffffd7ffdbfa730
    rbx 0xfffffd7ffdee1400
    rdx 0x0000000000000000
    rcx 0xfffffd7ffeaa8aa0
    rax 0x0000000000000000
    trapno 0x0000000000000001
    err 0x0000000000000000
    rip 0xfffffd7ffeaa8aa0:GetCompareSelectivity pushq %rbp
    cs 0x000000000000004b
    eflags 0x0000000000000282
    rsp 0xfffffd7ffdbfa5f8
    ss 0x0000000000000043
    fs 0x00000000000001bb
    gs 0x0000000000000000
    es 0x0000000000000000
    ds 0x0000000000000000
    fsbase 0xfffffd7ffdee1400
    gsbase 0xffffffff80000000
    step through the function prolog:
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa1
    0xfffffd7ffeaa8aa1: GetCompareSelectivity+0x0001: movq %rsp,%rbp
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aa4
    0xfffffd7ffeaa8aa4: GetCompareSelectivity+0x0004: subq $0x0000000000000190,%rsp
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8aab
    0xfffffd7ffeaa8aab: GetCompareSelectivity+0x000b: movq %rbx,0xfffffffffffffea8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ab2
    0xfffffd7ffeaa8ab2: GetCompareSelectivity+0x0012: movq %r12,0xfffffffffffffea0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ab9
    0xfffffd7ffeaa8ab9: GetCompareSelectivity+0x0019: movq %r13,0xfffffffffffffe98(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ac0
    0xfffffd7ffeaa8ac0: GetCompareSelectivity+0x0020: movq %r14,0xfffffffffffffe90(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ac7
    0xfffffd7ffeaa8ac7: GetCompareSelectivity+0x0027: movq %r15,0xfffffffffffffe88(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ace
    0xfffffd7ffeaa8ace: GetCompareSelectivity+0x002e: movq %rdi,0xfffffffffffffff8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ad2
    0xfffffd7ffeaa8ad2: GetCompareSelectivity+0x0032: movq %rsi,0xfffffffffffffff0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ad6
    0xfffffd7ffeaa8ad6: GetCompareSelectivity+0x0036: movq %rdx,0xffffffffffffffe8(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ada
    0xfffffd7ffeaa8ada: GetCompareSelectivity+0x003a: movq %rcx,0xffffffffffffffe0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ade
    0xfffffd7ffeaa8ade: GetCompareSelectivity+0x003e: movl %r8d,0xffffffffffffffdc(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ae2
    0xfffffd7ffeaa8ae2: GetCompareSelectivity+0x0042: movq %r9,0xffffffffffffffd0(%rbp)
    t@7 stepi
    t@7 (l@7) stopped in CostModel::GetCompareSelectivity at 0xfffffd7ffeaa8ae6
    0xfffffd7ffeaa8ae6: GetCompareSelectivity+0x0046: movl $0x0000000000000000,0xfffffffffffffeb0(%rbp)
    check the values of expr2_converted and reln
    t@7 p expr2_converted
    expr2_converted = 0xfffffd7ffeaa8aa0
    t@7 p reln
    reln = ' '
    t@7 p -fx reln
    reln = 0xa0
    and both values are incorrect because the values in registers %rcx and %r8
    have changed.sus
    Tom

    The original release of Sun Studio 10 had problems with saving and restoring registers in some cases on AMD64. Please visit the Sun Studio patch page at
    http://developers.sun.com/prodtech/cc/downloads/patches/index.html
    Download the current patches for
    C++ Compiler
    x86 compiler backend
    C++ shared library patch for your Solaris version.

  • Calling native functions from java w/out DLL

    If I invoke a JVM inside my c++ app and try to start up a class that calls a native function, do I still need a DLL for that? Or will it look to my header file and then look to my implementation somewhere in a c++ class?
    For example:
    WinMain() - Invokes JVM and loads "HelloWorld" java class, then calls its 'main' method.
    HelloWorld.java - 'main' method calls "displayHello();" a native function.
    HelloWorld.h - defines displayHello native interface
    So it looks simply to the cpp implementation of the interface...I tried executing this but it isnt working...is it even possible?

    OK, I attempted what you posted by writing the following code... please look at because I get a 'main' not found error. I am trying to execute this from a win32 app...
    Callbacks.java:
    class Callbacks {
      private native void nativeMethod(int depth);
      private void callback(int depth) {
        if (depth < 5) {
          System.out.println("In Java, depth = " + depth + ", about to enter C");
          nativeMethod(depth + 1);
          System.out.println("In Java, depth = " + depth + ", back from C");
        } else
          System.out.println("In Java, depth = " + depth + ", limit exceeded");
      public static void main(String args[]) {
        Callbacks c = new Callbacks();
        c.nativeMethod(0);
    }InvokeJVM.cpp:
    #include "InvokeJVM.h"
    //Log any windows errors
    void InvokeJVM::LogWin32Error(const char * pTitle){
         PCHAR pBuffer;   
         LONG  lError = GetLastError ( );
         FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
              NULL,                   
              lError,                   
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),                   
              (char *)&pBuffer,                   
              0,                   
              NULL );
         //LogError ("Win32 error: %s %s\n",pBuffer,pTitle);
         LocalFree ( pBuffer );
    //Get a string returned from the windows registry
    bool InvokeJVM::GetStringFromRegistry(HKEY key, const char *name, unsigned char *buf, int bufsize){
         DWORD type, size;
         if (RegQueryValueEx(key, name, 0, &type, 0, &size) == 0 && type == REG_SZ && (size < (unsigned int)bufsize)){
              if (RegQueryValueEx(key, name, 0, 0, buf, &size) == 0){
                   return true;
         return false;
    //Get the path to the runtime environment
    bool InvokeJVM::GetPublicJREHome(char *buf, int bufsize){
         HKEY key, subkey;   
         char version[MAX_PATH];  
         /* Find the current version of the JRE */
         if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, JRE_KEY,0,KEY_READ,&key)!=0){
              //LogError("Error opening registry key '" JRE_KEY "'\n");          
              return false;   
         if(!GetStringFromRegistry(key,"CurrentVersion",(unsigned char *)version, sizeof(version))){
              //LogError("Failed reading value of registry key:\n\t"JRE_KEY "\\CurrentVersion\n");          
              RegCloseKey(key);          
              return false;   
         if(strcmp(version, DOTRELEASE)!= 0){
              //LogError("Registry key '" JRE_KEY "\\CurrentVersion'\nhas value '%s', but '" DOTRELEASE "' is required.\n", version);
              RegCloseKey(key);          
              return false;   
         /* Find directory where the current version is installed. */   
         if(RegOpenKeyEx(key,version,0,KEY_READ, &subkey)!= 0){
              //LogError("Error opening registry key '"JRE_KEY "\\%s'\n", version);          
              RegCloseKey(key);          
              return false;   
         if(!GetStringFromRegistry(subkey, "JavaHome", (unsigned char *)buf, bufsize)){
              //LogError("Failed reading value of registry key:\n\t"JRE_KEY "\\%s\\JavaHome\n", version);          
              RegCloseKey(key);          
              RegCloseKey(subkey);          
              return false;   
         RegCloseKey(key);   
         RegCloseKey(subkey);   
         return true;
    //Native interface call to printf
    jint JNICALL _vfprintf_(FILE *fp, const char *format, va_list args){
         //LogError(format,args);     
         return 0;
    //Native interface call if the VM exited
    void JNICALL _exit_(jint code){     
         //LogError("VM exited");     
         exit(code);
    //Native interface call if the VM aborted
    void JNICALL _abort_(void){
         //LogError("VM aborted");     
         abort();
    //Load the Java Virtual Machine
    void InvokeJVM::LoadJVM(char* dir){
         HINSTANCE handle;     
         JavaVMOption options[5];     
         char JREHome[MAX_PATH];     
         char JVMPath[MAX_PATH];                                             
         char classpathOption[MAX_PATH];     
         char librarypathOption[MAX_PATH];
         if(!GetPublicJREHome(JREHome, MAX_PATH)){          
              //LogError("Could not locate JRE");          
              abort();     
         strcpy(JVMPath,JREHome);     
         strcat(JVMPath,"\\jre\\bin\\client\\jvm.dll");
         if ((handle=LoadLibrary(JVMPath))==0) {          
              //LogError("Error loading: %s", JVMPath);          
              abort();   
         CreateJavaVM_t pfnCreateJavaVM=(CreateJavaVM_t)GetProcAddress(handle,"JNI_CreateJavaVM");
         if (pfnCreateJavaVM==0){          
              //LogError("Error: can't find JNI interfaces in: %s",JVMPath);          
              abort();     
         strcpy(classpathOption,"-Djava.class.path=");
         strcat(classpathOption,dir);     
         strcat(classpathOption,";");     
         strcat(classpathOption,JREHome);     
         strcat(classpathOption,"\\lib");     
         strcat(classpathOption,";");
         strcat(classpathOption,JREHome);     
         strcat(classpathOption,"\\lib\\comm.jar");     
         strcpy(librarypathOption,"-Djava.library.path=");     
         strcat(librarypathOption,JREHome);     
         strcat(librarypathOption,"\\lib");
         OutputDebugString("classpath option=");     
         OutputDebugString(classpathOption);     
         OutputDebugString("\n");     
         OutputDebugString("librarypath option=");     
         OutputDebugString(librarypathOption);     
         OutputDebugString("\n");
         options[0].optionString=classpathOption;
         options[1].optionString=librarypathOption;          
         options[2].optionString="vfprintf";     
         options[2].extraInfo=_vfprintf_;     
         options[3].optionString="exit";     
         options[3].extraInfo=_exit_;     
         options[4].optionString="abort";     
         options[4].extraInfo=_abort_;
         vmArgs.version = JNI_VERSION_1_2;
         vmArgs.nOptions = 5;   
         vmArgs.options  = options;  
         vmArgs.ignoreUnrecognized = false;
         if(pfnCreateJavaVM(&jvm,(void**)&env, &vmArgs) != 0){
              //LogError("Could not create VM");
              abort();     
    }Winmain.cpp:
    #define WIN32_MEAN_AND_LEAN
    #define WIN32_EXTRA_LEAN
    #include <windows.h>
    #include "oglwindow.h"          // the OpenGL window class
    #include "vector.h"
    #include "engine.h"               // the engine's main class
    #include "BrimstoneEngine.h"
    #include "InvokeJVM.h"
    JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld(JNIEnv *, jobject){
        MessageBox(NULL, "Hello From Java!", "Error", MB_OK);
        return;
    JNIEXPORT void JNICALL Java_Callbacks_nativeMethod(JNIEnv *env, jobject obj, jint depth){
      jclass cls = env->GetObjectClass(obj);
      jmethodID mid = env->GetMethodID(cls, "callback", "(I)V");
      if (mid == 0) {
        return;
      printf("In C, depth = %d, about to enter Java\n", depth);
      env->CallVoidMethod(obj, mid, depth);
      printf("In C, depth = %d, back from Java\n", depth);
    JNINativeMethod methods[] = {"nativeMethod","()V", Java_Callbacks_nativeMethod};
    WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR, int nCmdShow){
         InvokeJVM javaVirtualMachine;
         int loopRet;
         javaVirtualMachine.running = false;
         CoInitialize(NULL);
         if (!COGLWindow::RegisterWindow(hInst)){
              MessageBox(NULL, "Failed to register window class", "Error", MB_OK);
              return -1;
         BrimstoneEngine *engine = NULL;
         try{
              char path[MAX_PATH];  
              char drive[MAX_PATH];   
              char file[MAX_PATH];   
              char dir[MAX_PATH];   
              char ext[MAX_PATH];
              jclass  cls, cls1;     
              jmethodID mid;     
              jobjectArray args;
              jint err;
              _splitpath(path,drive,dir,file,ext);          
              javaVirtualMachine.LoadJVM(dir);     
              if(javaVirtualMachine.env == NULL){               
                   MessageBox(NULL, "Could not load VM", "Error", MB_OK);
                   abort();          
              if(GetModuleFileName(NULL, path, MAX_PATH) == 0){               
                   javaVirtualMachine.LogWin32Error("Getting module filename");          
                   abort();          
              cls = javaVirtualMachine.env->FindClass("Callbacks");
              if(cls == NULL){               
                   MessageBox(NULL, "Could not find class %s (or its superclass)", "Error", MB_OK);
                   exit(-1);          
              err = javaVirtualMachine.env->RegisterNatives(cls, methods, 1 );
              mid = javaVirtualMachine.env->GetMethodID(cls, "main", "([Ljava/lang/String;)V");
              if(mid == NULL){
                   MessageBox(NULL, "Could not find method 'main'", "Error", MB_OK);
                   exit(-1);          
              args = javaVirtualMachine.env->NewObjectArray(2-2, javaVirtualMachine.env->FindClass("java/lang/String"), NULL);          
              if(args==NULL){               
                   MessageBox(NULL, "Could not create args array", "Error", MB_OK);
              for(int arg=0; arg < 2;arg++)     {               
                   javaVirtualMachine.env->SetObjectArrayElement(args, arg, javaVirtualMachine.env->NewStringUTF(argv[arg+2]));      
              javaVirtualMachine.env->CallStaticVoidMethod(cls,mid,args);     
              javaVirtualMachine.jvm->DestroyJavaVM();
              engine = new BrimstoneEngine("OpenGL Game", FALSE, 800, 600, 16);
              loopRet = engine->EnterMessageLoop();
              delete engine;
              return loopRet;
         catch(char *sz)
              MessageBox(NULL, sz, 0, 0);
              delete engine;
         CoUninitialize();
         return -1;
    }any help is always appreciated

  • VPD: Problems calling a function on another schema

    Here's the setup:
    I've create a schema called "AllYourBase".  It contains all of my tables, views, functions, procs, etc.
    These tables are protected by a DBMS_RLS policy.  The policy uses a function to define its predicate which looks like this:
    create or replace function tous_filter(schemaName varchar2, tableName varchar2)
    return varchar2 is
    begin
    return  'account = sys_context(''USERENV'', ''CLIENT_IDENTIFIER'')';
    end;
    All of the tables have an account column for this to work.  So far, this is a pretty basic VPD setup.
    I have other db users that login and view data in the "AllYourBase" schema.
    So when "ArbyLong" logs in, I set sys_context('USERENV', 'CLIENT_IDENTIFIER') to "ArbyLong", and when he runs a query, he gets back his rows.
    Now, "AllYourBase" has several functions.  Here's a very contrived, simplified example of one (but it illustrates the issue I'm running into just fine):
    create or replace function getUserID
    return integer is retval integer;
    begin
    select user_id into retval from users;
    return (retval);
    end;
    When "ArbyLong" runs the equivalent query (select user_id from users), he gets back the one row where the account column is equal to "ArbyLong", as expected.
    But this getUserID function lives in the "AllYourBase" schema.  And here's the catch: I've made "AllYourBase" exempt from the policies by running "grant exempt access policy to AllYourBase".
    When "ArbyLong" runs the function getUserID, it runs in the "AllYourBase" schema and pulls ALL of the rows from the users table.
    This particular function simply errors out (since it's only expecting one row), but other functions are returning data that the logged in user shouldn't see.
    So even though there are policies in place, by calling a function on another schema who is exempt from the policies, a user is able to see all returned data and not just the rows they are normally limited to.
    Ultimately my question is this: Is there a way to enforce VPD policies when a user calls a function that lives in another schema?
    Doing my own research, the answers I've come up with are:
    * Don't use "grant exempt policy"!
    * Put the function directly into the users' schemas.  So "ArbyLong" would have his own getUserID function that would look at the "AllYourBase" users table.
    I'd rather not do either of these, so does anyone have any other ideas?  If it turns out these are the only solutions, then I'll go with one of them.
    Thanks!

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Problems calling a function from another function

    Hello all.
    I am trying to create a function that will loop a few other function.
    Basically the main function is this
                        private function publish(event:MouseEvent):void
                            if (doPublish.label == 'Publish')
                                // create a new NetStream object for video publishing
                                nsPublish = new NetStream(nc);
                                nsPublish.addEventListener(NetStatusEvent.NET_STATUS, nsPublishOnStatus);
                                // set the buffer time to zero since it is chat
                                nsPublish.bufferTime = 0;
                                // publish the stream by name
                                nsPublish.publish(publishName.text);
                                // add custom metadata to the stream
                                var metaData:Object = new Object();
                                metaData["description"] = "Chat using VideoChat example."
                                nsPublish.send("@setDataFrame", "onMetaData", metaData);
                                // attach the camera and microphone to the server
                                nsPublish.attachCamera(camera);
                                nsPublish.attachAudio(microphone);
                                doPublish.label = 'Stop';
                            else
                                // here we are shutting down the connection to the server
                                nsPublish.attachCamera(null);
                                nsPublish.attachAudio(null);
                                nsPublish.publish("null");
                                nsPublish.close();
                                doPublish.label = 'Publish';
    I am then trying to call that function like this
                protected function startloop():void {
                    publish(event);
    But i get the error Access of undefined property event.
    Any ideas on how i can call this function ?  I need to call it as part of a loop against a timer..
    Thanks in advance

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Problem calling Oracle function from Access 2007 / ADO

    Hopefully, I'm posting this in the correct forum. I'm also posting on an Access forum as I'm not entirely sure where the issue lies.
    I'm calling an Oracle function from Access 2007 using an ADO Command object.
    The function takes three input parameters and has a return value and an output parameter. The output parameter is a BLOB, and the return value is varchar2 (either "T" or "N") based on the outcome of the function.
    If I pass correct values to the function, I get the following error message (errs out on the command.execute line):
    Run-time error '-2147467259 (80004005)':
    [Oracle][ODBC][Ora]ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at line 1
    Here's the function:
    FUNCTION GET_ITEMREV_ATTACH(P_ORGANIZATION_ID IN NUMBER,
    P_INVENTORY_ITEM_ID IN NUMBER,
    P_REVISION IN VARCHAR2,
    X_DRAWING OUT BLOB) RETURN VARCHAR2 IS
    RESULT VARCHAR2(1);
    BEGIN
    RESULT := 'T';
    BEGIN
    SELECT L.FILE_DATA
    INTO X_DRAWING
    FROM FND_ATTACHED_DOCUMENTS AD,
    MTL_ITEM_REVISIONS_B IR,
    FND_DOCUMENTS_TL D,
    FND_LOBS L
    WHERE AD.ENTITY_NAME = 'MTL_ITEM_REVISIONS' AND
    AD.PK1_VALUE = IR.ORGANIZATION_ID AND
    AD.PK2_VALUE = IR.INVENTORY_ITEM_ID AND
    AD.PK3_VALUE = IR.REVISION_ID AND
    AD.CATEGORY_ID = 1001216 AND
    D.DOCUMENT_ID = AD.DOCUMENT_ID AND
    D.LANGUAGE = 'US' AND
    L.FILE_ID = D.MEDIA_ID AND
    IR.ORGANIZATION_ID = P_ORGANIZATION_ID AND
    IR.INVENTORY_ITEM_ID = P_INVENTORY_ITEM_ID AND
    IR.REVISION = P_REVISION;
    EXCEPTION
    WHEN OTHERS THEN
    RESULT := 'N';
    END;
    RETURN(RESULT);
    END GET_ITEMREV_ATTACH;
    Here's the VB code I'm using to call the function:
    Private Sub Command8_Click()
    Dim CMD As New ADODB.Command
    Dim conn As ADODB.Connection
    Dim Param1 As ADODB.Parameter
    Dim Param2 As ADODB.Parameter
    Dim Param3 As ADODB.Parameter
    Dim ParamBlob As ADODB.Parameter
    Dim ParamReturn As ADODB.Parameter
    Set conn = New ADODB.Connection
    With conn
    .ConnectionString = "Driver={Oracle in OraHome92};Dbq=OAPLY;UID=***;PWD=*******"
    .CursorLocation = adUseClient
    .Open
    End With
    Set CMD = New ADODB.Command
    Set CMD.ActiveConnection = conn
    CMD.CommandText = "immi_attach_pub.get_itemrev_attach"
    CMD.CommandType = adCmdStoredProc
    Set ParamReturn = CMD.CreateParameter("RESULT", adVarChar, adParamReturnValue, 1)
    CMD.Parameters.Append ParamReturn
    Set Param1 = CMD.CreateParameter("P_ORGANIZATION_ID", adInteger, adParamInput, 1, 6)
    CMD.Parameters.Append Param1
    Set Param2 = CMD.CreateParameter("P_INVENTORY_ITEM_ID", adInteger, adParamInput, 4, 5207)
    CMD.Parameters.Append Param2
    Set Param3 = CMD.CreateParameter("P_REVISION", adVarChar, adParamInput, 2, "04")
    CMD.Parameters.Append Param3
    Set ParamBlob = CMD.CreateParameter("X_DRAWING", adLongVarBinary, adParamOutput, 200000)
    CMD.Parameters.Append ParamBlob
    CMD.Execute , , adExecuteNoRecords *** this is where the error occurs
    conn.Close
    MsgBox CMD.Parameters("RESULT")
    End Sub
    I've tried using different data types for the varchar2 parameters (adVarChar, adBSTR, adChar) with no difference.
    If I pass a bogus value for Param3...."'04'"...the function returns "N" indicating that it actually executed something. But, when I pass the correct value "04", it returns the above mentioned error.
    I can execute the function in PL/SQL just fine, so I'm thinking there's something wrong with the parameters, datatype, or other definitions on the Access side.
    Does anyone have any thoughts? I'm at a dead end with this. Sorry for the long post. Thank you.

    I tried your code with 11107 ODBC/client/database (but with a NULL output blob for convenience sake) and got no errors.
    If you're using 92 ODBC/client, you may want to try upgrading to something more current, or at least getting the latest patch(9208) to see if that helps. Since it works for me I'm guessing it may be a resolved bug in that version.
    Hope it helps,
    Greg

  • Application Class Loader problem calling virtual function

    Hello everyone
    I have run in to very strange behavior of JVM
    I have created a class loader which allows my to load classes from
    jar file, regardless that URLClassLoader supplies this functionality.
    I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
    public interface I {
       public void init();
    public class AAA implements
       public void init(){
    public class BBB extends AAA{
       public void init(){
          //here comes implementation
    }Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
    ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
    Class cl = classLoader. loadClass(�com.product.BBB�,true);
    I myInterface = cl.newInstance();
    myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
    Can somebody help me what am I doing wrong?
    Class Loader code attached below
      public class ByteStreamClassLoader   extends ClassLoader {
        protected HashMap m_cache = new HashMap();
        public void clearCashe() {
          m_cache = new HashMap();
        private String definePackage(String className) {
          StringBuilder strB = new StringBuilder();
          //Class name must be removed from the URI in order to define a package
          String[] packageArray = className.split("\\.");
          for (int i = 0; i < packageArray.length - 1; i++) {
            strB.append(packageArray).append(".");
    String packageName = strB.toString();
    packageName = packageName.substring(0, packageName.length() - 1);
    if (getPackage(packageName) == null) {
    m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
    definePackage(packageName, null, null, null, null, null, null, null);
    return packageName;
    public synchronized Class loadClass(String name, boolean resolve) throws
    ClassNotFoundException {
    name = name.replaceAll("/", ".").replaceAll(".class", "");
    //Try to locate the Class in cashe
    Class c = (Class) m_cache.get(name);
    //Try to locate the Class in the System Class Loader
    if (c == null) {
    try {
    c = ClassLoader.getSystemClassLoader().loadClass(name);
    catch (Exception ex) {}
    else {
    m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
    //Load the class from byte array
    if (c == null) {
    String resourceName = name;
    if (!resourceName.endsWith(".class")) {
    resourceName = resourceName.concat(".class");
    //Retrieve class byte representation
    if (resourceName.indexOf(".") != -1) {
    resourceName =
    resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
    //Use the ByteStreamClassLoader to load the class from byte array
    byte[] classByteArray = null;
    try {
    classByteArray = getResourceBytes(resourceName);
    catch (IOException ex1) {
    throw new ClassNotFoundException(
    "Could not load class data." + ex1.getMessage());
    m_logger.log(
    Level.FINEST, "Loading class '" +
    name + "' Byte Length: " + classByteArray.length);
    String p = definePackage(name);
    c = defineClass(
    name,
    classByteArray,
    0,
    classByteArray.length,
    ByteStreamClassLoader.class.getProtectionDomain());
    m_cache.put(name, c);
    if (resolve) {
    resolveClass(c);
    return c;

    Hello everyone
    I have run in to very strange behavior of JVM
    I have created a class loader which allows my to load classes from
    jar file, regardless that URLClassLoader supplies this functionality.
    I am using this class loader to load some classes and call their virtual functions. The class diagram looks like that:
    public interface I {
       public void init();
    public class AAA implements
       public void init(){
    public class BBB extends AAA{
       public void init(){
          //here comes implementation
    }Interface I and class AAA are loaded with System Class loader and Class BBB is loaded using my class loader from jar file.
    ByteStreamClassLoader  classLoader =  new ByteStreamClassLoader  ();
    Class cl = classLoader. loadClass(�com.product.BBB�,true);
    I myInterface = cl.newInstance();
    myInterface.init();The problem is that from some unknown reason java class AAA.init() instead of BBB.init().
    Can somebody help me what am I doing wrong?
    Class Loader code attached below
      public class ByteStreamClassLoader   extends ClassLoader {
        protected HashMap m_cache = new HashMap();
        public void clearCashe() {
          m_cache = new HashMap();
        private String definePackage(String className) {
          StringBuilder strB = new StringBuilder();
          //Class name must be removed from the URI in order to define a package
          String[] packageArray = className.split("\\.");
          for (int i = 0; i < packageArray.length - 1; i++) {
            strB.append(packageArray).append(".");
    String packageName = strB.toString();
    packageName = packageName.substring(0, packageName.length() - 1);
    if (getPackage(packageName) == null) {
    m_logger.log(Level.FINEST, "Defining package '" + packageName + "'");
    definePackage(packageName, null, null, null, null, null, null, null);
    return packageName;
    public synchronized Class loadClass(String name, boolean resolve) throws
    ClassNotFoundException {
    name = name.replaceAll("/", ".").replaceAll(".class", "");
    //Try to locate the Class in cashe
    Class c = (Class) m_cache.get(name);
    //Try to locate the Class in the System Class Loader
    if (c == null) {
    try {
    c = ClassLoader.getSystemClassLoader().loadClass(name);
    catch (Exception ex) {}
    else {
    m_logger.log(Level.FINEST, "Class '" + name + "' found in cache");
    //Load the class from byte array
    if (c == null) {
    String resourceName = name;
    if (!resourceName.endsWith(".class")) {
    resourceName = resourceName.concat(".class");
    //Retrieve class byte representation
    if (resourceName.indexOf(".") != -1) {
    resourceName =
    resourceName.replaceAll("\\.", "/").replaceAll("/class", ".class");
    //Use the ByteStreamClassLoader to load the class from byte array
    byte[] classByteArray = null;
    try {
    classByteArray = getResourceBytes(resourceName);
    catch (IOException ex1) {
    throw new ClassNotFoundException(
    "Could not load class data." + ex1.getMessage());
    m_logger.log(
    Level.FINEST, "Loading class '" +
    name + "' Byte Length: " + classByteArray.length);
    String p = definePackage(name);
    c = defineClass(
    name,
    classByteArray,
    0,
    classByteArray.length,
    ByteStreamClassLoader.class.getProtectionDomain());
    m_cache.put(name, c);
    if (resolve) {
    resolveClass(c);
    return c;

  • Java.lang.UnsatisfiedLinkError when calling native function

    I got exception as
    java.lang.UnsatisfiedLinkError: no rvjs11 in java.library.path
    Do I need any addtional setting?

    You need to make sure that the native library is in your "dynamic
    library search path". You typically set this using an environment
    variable (e.g., PATH on Windows, LD_LIBRARY_PATH on most Unix variants
    except HP-UX and AIX, SHLIB_PATH on HP-UX, or LIBPATH on AIX).
    Hope this helps,
    Robert
    Eric Shen wrote:
    I got exception as
    java.lang.UnsatisfiedLinkError: no rvjs11 in java.library.path
    Do I need any addtional setting?

  • How to call C function in .m file from another function in a .mm file

    I am making an interface class between a C library and an objetive C application.
    I have not problem calling function the C library from .mm funstions,
    but I am having problems calling .m functions from the .mm class.
    here is an example of what I mean.
    here in my .m vector file
    *struct dVector*
    * float m_x;*
    * float m_y;*
    * float m_z;*
    * float m_w;*
    *struct dVector InitVector (float x, float y, float z, float w);*
    *struct dVector AddVector (struct dVector* A, struct dVector* B);*
    *struct dVector SubVector (struct dVector* A, struct dVector* B);*
    here is my .mm class
    *#import <Foundation/Foundation.h>*
    *@interface iNewton : NSObject*
    * void* m_world;*
    *-(id) init;*
    *-(void) dealloc;*
    -(void) CreateBox: (Entity*) ent: (int) shapeId;*
    @end
    here is the implemrntation of function funtion CreateBox in a .mm file
    [code]-(void*) CreateBox: (Entity*) ent: (int) shapeId
    struct dVector minBox;
    struct dVector maxBox;
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    //calculate the box size and dimensions of the physics collision shape
    // this report a link errors, and I do no knwo why
    struct dVector size = SubVector(&maxBox, &minBox);
    struct dVector origin = AddVector (&maxBox, &minBox);
    // thsi work without problemen
    return NewtonCreateBox ((NewtonWorld*) world, size.m_x, size.m_y, size.m_z, shapeId, &offset.mfront.mx);
    I get these compiler errors
    Building target “tutorial102AddingRigidBody” of project “newton_iPhone” with configuration “Debug_Emulation” — (3 errors)
    cd /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone
    setenv MACOSXDEPLOYMENTTARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr /bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2 .1.sdk -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/../sdk -F/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -filelist /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBody.build/ Objects-normal/i386/tutorial_102AddingRigidBodies.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics -lnewton_iPhoneEmulation -o /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBodies.app/ tutorial_102AddingRigidBodies
    Undefined symbols:
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    Build failed (3 errors)
    Basically I can call objective C class methods from .mm files,
    but I can not call functions who are not members of a class from .mm funtions.
    Does any one knows how I can solve this?
    I have two books on objective C and neither show how to do that.
    Please I will apreciate if some one can help me with this.
    Julio Jerez

    julio jerez wrote:
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    why will tha be wrong?
    ent is a objective C class with a method GetBBox
    wich I use in hundred of places with out problem.
    Beside that is not the problem that.
    Well, you've got me on this one. You are correct. Apparently you don't need to specify the parameter names. Still, I strongly encourage you to use parameter names. Even though they apparently aren't required, I've never seen them not used. I would have expected to see:
    [ent GetBBoxMin: & minBox max: & maxBox]
    The problem is calling C function that are declared in .m files.
    if you read the errors, they are linking errors not compiler errors.
    this is a C function that is declared in a .m file
    struct dVector size = SubVector(&maxBox, &minBox);
    beside I also use those functions in many other place as well in teh project and they work.
    If it helps I can post a link to the a download place to the xcode project maybe it is eassy to see what I am trying to do.
    That would probably be a good idea.
    Normally, all you need is
    extern "C"
    but there is so much missing from what you've posted that I can't tell for sure what is going on.

  • Calling javascript function from report customization form

    I have been unable to call any user-defined javascript function from Portal Report Customization forms.
    Even a simple Message Box function doesn't work. I've been placing my code in the ..after header PL/SQL section for the report customization form.
    htp.p('<script type="javascript">');
    htp.p('function MsgBox(message){');
    htp.p('alert(message);}');
    htp.p('</script>');
    htp.p('See if it works');
    I have verified in plain html that my syntax is fine. Even the syntax rendered by portal is correct:
    <script type="javascript">
    function MsgBox(message){
    alert(message);}
    </script>
    See if it works
    Despite this, you will get a javascript error that an Object is expected, MsgBox not defined. Clearly from the script above MsgBox is defined.
    I have tried any number of calls to user defined functions and can't get anything to work. However, calling native functions like 'alert' works fine ( ie
    See if it works
    Anyone know how I can call a user defined javascript function in a Portal Report Customization form?

    Try changing the code
    htp.p('<script type="javascript">');
    to
    htp.p('<script language="javascript">');
    Thanks
    -Krishnamurthy

  • Urgent - How to call native methods from J2ME

    Hi,
    I have to do some very heavy processing work, so I have my code written in C. And now I want these native functions to be called from a J2ME application. I had thought this was not possible and J2ME did not support something like JNI as J2SE did.
    However, when contacted with Sun Technical Support we were advised to use KNI in J2ME. I went through the KNI documentation and did not find any example to do so.
    On reading about it I understood that it cannot be implemented by developers as the native functions if any using KNI should be implemented while compiling the KVM.
    I would like to know whether my understanding is correct, or is it possible to call native functions from J2ME. Say I would like to have my native functions called from J2ME and run it on my Nokia N73 or other such phones.
    Experts please clear this.
    Regards,
    Kamalakshan

    Hi,
    You are right in your assumptions regarding KNI. Here is some related thread that might also help. There has been [some work|http://developer.symbian.com/main/downloads/papers/MIDlet_Native_Services_Framework/MIDlet_Native_Services_Framework_v1.1.zip] done in accessing native services through a MIDlet.
    Mihai

  • Trying to call a function from C#

    Hi all,
    I am having problems calling a function that returns a sys refcursor and takes a varchar2 as an input. From the SQL Developer IDE I see that the function is run like
    DECLARE
    X_AR_MHTR VARCHAR2(200);
    v_Return sys_refcursor;
    BEGIN
    X_AR_MHTR := 697678;
    v_Return := CMS_SMS.FOR_WEB.WEB_STATION_1(
    X_AR_MHTR => X_AR_MHTR
    /* Legacy output:
    DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
    :v_Return := v_Return; --<-- Cursor
    END;
    here is my C# code
    public static void getTilemetriseis(bool isLemessos, string AMSet, out OracleDataReader dr)
    DataSet ds = new DataSet();
    OracleDataAdapter ad = new OracleDataAdapter();
    OracleCommand cmd = new OracleCommand();
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = "CMS_SMS.FOR_WEB.WEB_Station_1";
    if (isLemessos)
    cmd.Parameters.Add("X_AR_MHTR", OracleDbType.Varchar2, ConfigurationManager.AppSettings["LemessosArMhtr"].ToString(), ParameterDirection.Input);
    cmd.Parameters.Add(new OracleParameter("anexoflCur", OracleDbType.RefCursor, ParameterDirection.ReturnValue));
    // ad.SelectCommand.CommandText = string.Format(@"select m_code,ar_mhtr,city,address,stcode
    // from cms_sms.FOR_WEB.flowmetersall where ar_mhtr = {0}
    // order by length(ar_mhtr),ar_mhtr", ConfigurationManager.AppSettings["LemessosArMhtr"].ToString());
    else
    cmd.Parameters.Add("X_AR_MHTR", OracleDbType.Varchar2, "697678", ParameterDirection.Input);
    cmd.Parameters.Add(new OracleParameter("v_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue));
    // ad.SelectCommand.CommandText = string.Format(@"select m_code,ar_mhtr,city,address,stcode
    // from cms_sms.FOR_WEB.flowmetersall where ar_mhtr= -1
    // order by length(ar_mhtr),ar_mhtr", AMSet);
    cmd.Connection = OracleDBManager.getOracleCMSConnection();
    cmd.ExecuteNonQuery();
    dr = (OracleDataReader)cmd.Parameters["v_Return"].Value;
    cmd.Connection.Close();
    The error rises on cmd.ExecuteNonQuery() and is described as
    ORA-06550:
    PLS-00306: wrong number or type of argument
    Any ideas?

    Off the top of my head, your parameter type on the second parameter is wrong. The function doesn't have a return value, one of the parameters contains it. So the second parameter's type can't be ReturnValue (should be output).
    Either that or change the function to only have one parameter and add RETURN sys_refcursor into the definition, at which point you can use ReturnValue.
    Here's an example: http://stackoverflow.com/questions/1773534/what-is-the-right-way-to-call-an-oracle-stored-function-from-ado-net-and-get-the
    Edited by: Tridus on Mar 20, 2013 10:24 AM

  • Problem while calling RFC function module in java

    Hi all
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<system.ab.ydydy.yyyd.com>, GWSERV=sapgw00, ASHOST=<system.ab.ydydy.yyyd.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<system.ab.ydydy.yyyd.com>' unknown
    TIME        Mon Jun 06 14:50:25 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname '<system.ab.ydydy.yyyd.com>' not found
    SYSTEM CALL gethostbyname_r
    COUNTER     1
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:43)
         at MyProject.Bapi2.main(Bapi2.java:231)
    Pl help me
    pradeep

    Hi
    This is my code....
    Created on Jun 2, 2005
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package MyProject;
    @author pradeep
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import com.sap.mw.jco.*;
    public class Bapi2 extends Object {
       JCO.Client mConnection;
       JCO.Repository mRepository;
       public Bapi2() {
           try {
              // Change the logon information to your own system/user
              mConnection =
                JCO.createClient("122", // SAP client
                   "<pradeep>", // userid
                   "*****", // password
                   "EN", // language
                   "<abc11.aa.abc23.company.com>", // application server host name
                   "<00>");//system no
              mConnection.connect();
              mRepository = new JCO.Repository("HLL", mConnection);
          catch (Exception ex) {
            ex.printStackTrace();
            System.exit(1);
          JCO.Function function = null;
          JCO.Table codes = null;
            try {
               function = this.createFunction("BAPI_COMPANYCODE_GETLIST");
               if (function == null) {
                 System.out.println("BAPI_COMPANYCODE_GETLIST" +
                                         " not found in SAP.");
                 System.exit(1);
               mConnection.execute(function);
               JCO.Structure returnStructure =
                 function.getExportParameterList().getStructure("RETURN");
               if (! (returnStructure.getString("TYPE").equals("") ||
                        returnStructure.getString("TYPE").equals("S")) ) {
                 System.out.println(returnStructure.getString("MESSAGE"));
                 System.exit(1);
               codes =
                 function.getTableParameterList().getTable("COMPANYCODE_LIST");
               codes.setRow(2);
    codes.deleteRow();
    codes.deleteRow(5);
    codes.appendRow();
    codes.setValue("XXXX", "COMP_CODE");
    codes.setValue("Does not exist", "COMP_NAME");
    codes.appendRows(2);
    codes.setValue("YYYY", "COMP_CODE");
    codes.setValue("Does not exist either", "COMP_NAME");
    codes.nextRow();
    codes.setValue("ZZZZ", "COMP_CODE");
    codes.setValue("Nor does this", "COMP_NAME");
    for (int i = 0; i < codes.getNumRows(); i++) {
    codes.setRow(i);
                 System.out.println(codes.getString("COMP_CODE") + '\t' +
                                         codes.getString("COMP_NAME"));
            catch (Exception ex) {
               ex.printStackTrace();
               System.exit(1);
            try {
               codes.firstRow();
               for (int i = 0; i < codes.getNumRows(); i++, codes.nextRow()) {
                 function = this.createFunction("BAPI_COMPANYCODE_GETDETAIL");
                 if (function == null) {
                    System.out.println("BAPI_COMPANYCODE_GETDETAIL" +
                                            " not found in SAP.");
                    System.exit(1);
                 function.getImportParameterList().
                    setValue(codes.getString("COMP_CODE"), "COMPANYCODEID");
                 mConnection.execute(function);
                 JCO.Structure returnStructure =
                    function.getExportParameterList().getStructure("RETURN");
                 if (! (returnStructure.getString("TYPE").equals("") ||
                          returnStructure.getString("TYPE").equals("S") ||
                          returnStructure.getString("TYPE").equals("W")) ) {
                    System.out.println(returnStructure.getString("MESSAGE"));
                 JCO.Structure detail =
                    function.getExportParameterList().
                    getStructure("COMPANYCODE_DETAIL");
                 System.out.println(detail.getString("COMP_CODE") + '\t' +
                                         detail.getString("COUNTRY") + '\t' +
                                         detail.getString("CITY"));
           catch (Exception ex) {
              ex.printStackTrace();
              System.exit(1);
           mConnection.disconnect();
         public JCO.Function createFunction(String name) throws Exception {
           try {
              IFunctionTemplate ft =
                mRepository.getFunctionTemplate(name.toUpperCase());
              if (ft == null)
                return null;
              return ft.getFunction();
          catch (Exception ex) {
            throw new Exception("Problem retrieving JCO.Function object.");
       public static void main (String args[]) {
          Bapi2 app = new Bapi2();
    This is the error i'm getting...
    com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
    Connect_PM  GWHOST=<abc11.aa.abc23.company.com>, GWSERV=sapgw00, ASHOST=<abc11.aa.abc23.company.com>, SYSNR=00
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname '<abc11.aa.abc23.company.com>' unknown
    TIME        Mon Jun 06 17:15:12 2005
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        332
    DETAIL      NiPGetHostByName2: hostname
                '<abc11.aa.abc23.company.com>' not
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native Method)
         at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(MiddlewareRFC.java:1098)
         at com.sap.mw.jco.JCO$Client.connect(JCO.java:2983)
         at MyProject.Bapi2.<init>(Bapi2.java:45)
         at MyProject.Bapi2.main(Bapi2.java:233)
    Thx
    PRadeep

  • Native function call

    I created a native c class which is called in a java code. when i try to execute the program , there is "java.lang.UnsatisfiedLinkError". I tried to place the dll file created in the appropriate directory, but still i get the same error.
    My java class( which tries to access the c class) is in a package which is inside another directory, will this create any problem?
    kindly help me with ur suggestions. thank you

    I am attaching the code fragments below:
    package JavaFem;
         public class FESAMDSolver extends FESolver {
         public native void cAMDorder(int neq, int[]ap, int[]ai, int[]pv);
              static {
              //System.loadLibrary("testamd");
              System.load("Z:/testamd.dll");
              public void solve() {
         cAMDorder(num_eqns, Ap, Ai, pVector); // calling the native C method
    My native function code :
    #include <jni.h>
    #include "JavaFem_0005cFESAMDSolver.h"
    #include "amd.h"
    JNIEXPORT void JNICALL Java_JavaFem_0005cFESAMDSolver_cAMDorder
    (JNIEnv *env, jobject obj, jint n, jintArray ApArray , jintArray AiArray, jintArray PArray)
              jintArray Ap = (*env)->GetIntArrayElements(env, ApArray, 0);
              jintArray Ai = (*env)->GetIntArrayElements(env, AiArray, 0);
              jintArray P = (*env)->GetIntArrayElements(env, PArray, 0);
              (void) amd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL) ;
    Directory structure
    JavaFemViewer\JavaFem
         JavaFem is a package inside the JavaFemViewer folder.
    My testamd.dll file and all C file objs are located inside the JavaFem directory. When i created a dll file, there was no header file generated along with it.
    The error i get is displayed below:
    java.lang.UnsatisfiedLinkError: cAMDorder
    at JavaFem.FESAMDSolver.cAMDorder(Native Method)

Maybe you are looking for

  • EBS upgrade from 11i to R12 using Maintenance Wizard question

    I have installed Maintenance Wizard in development envrionment. I picked module to upgrade 11i to R12. When I am defining the node it not only picked up 11i nodes but required me to configure R12 nodes. So Do I have to to create upgrade file system(f

  • Throwing error when Creating  Info record

    Hai, When Creating Info record . I maintained standard Qty, Min qty ,price and Planned dely time . It is not saving and there is an error message that "Maintian all entries in Reqt fields" and Cursor is blinking at Planned delytime . and Not saved/ C

  • Waiting Reply

    Hi Dears,            ow i'm in critical position could u suggestion regarding "how to  upload the  excel sheet  customer master data  using BAPI ?" i will be waiting for reply . regards eswar.

  • Derivation Rule: COPA

    Hello Everyone, Could you please tell me how to write derivation rule in COPA.  I would appreciation if you send me any document related to it. Thanks in advance. Sneha

  • Email false spam rejections

    When is Verizon going to get off its butt and do something about the problem its third party spam filterer is causing with sending email attachments etc. Email with the following link was rejected over 10 times by Verizon as being a spam. http://navy