Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Samsung Micro RGB R95H, il primo LCD a LED rossi, verdi e blu di Samsung alla prova del banco di misura
Samsung Micro RGB R95H, il primo LCD a LED rossi, verdi e blu di Samsung alla prova del banco di misura
Il primo Micro RGB di Samsung per il salotto ่ il 65 pollici da 2.749 euro. Sul banco di misura abbiamo rilevato 2.000 nit di picco, nero assoluto con il local dimming e il 91,4% del BT.2020, il colore pi๙ ampio che abbiamo misurato su un LCD
iPhone 18 Pro: la recensione del miglior iPhone compatto di sempre
iPhone 18 Pro: la recensione del miglior iPhone compatto di sempre
Apple ha rinnovato iPhone 18 Pro soprattutto dentro: chip A20 Pro a 2 nm con memoria affiancata al SoC, camera di vapore tre volte pi๙ ampia, Dynamic Island pi๙ piccola del 25% grazie a Face ID sotto il display e fotocamera principale con diaframma variabile da f/1.48 a f/4. Lo abbiamo misurato al colorimetro e nei benchmark, usato con iOS 27 e messo alla prova in fotografia tra laghi, borghi e interni poco illuminati
Panasonic, 30 anni di Toughbook: la "Bibbia" di mille regole dietro i nuovi G3 e 34
Panasonic, 30 anni di Toughbook: la "Bibbia" di mille regole dietro i nuovi G3 e 34
A Londra, per il trentennale dei Toughbook, Panasonic ha presentato il tablet G3 e il 2-in-1 34. Con Jon Tucker, a capo dell'ingegneria europea, abbiamo parlato di ci๒ che non si vede: batterie, antenne, porte seriali e accorgimenti nati sul campo
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 30-10-2009, 15:39   #1
ermasto
Senior Member
 
L'Avatar di ermasto
 
Iscritto dal: Mar 2004
Messaggi: 581
[C&JNI]Undefined Reference To

Allora ragazzi ho un problema con un applicazione abbastanza complessa che mi ่ stata data da ampliare ma non riesco a farla partire...

Questa applicazione usa tramite jni un applicazione in c che poi tramite agneti mobili ่ possibile spostare sospendere ecc ecc, ora il mio problema risiede nella creazione della libreria .so che serve a far funzionare l'applicazione.
E' stato creato un manager java che post compilazione ha dato un file .h e da questo ่ stata implementato un manager nativo.c

Codice:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h> 
#include <jni.h>
#include <string.h>
#include <signal.h>
/* Header for class manager_NativeManager */

#ifndef _Included_manager_NativeManager
#define _Included_manager_NativeManager
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     manager_NativeManager
 * Method:    start_
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_start_1
  (JNIEnv *, jobject, jint);

/*
 * Class:     manager_NativeManager
 * Method:    suspend_
 * Signature: (II)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_suspend_1
  (JNIEnv *, jobject, jint, jint);

/*
 * Class:     manager_NativeManager
 * Method:    resume_
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_resume_1
  (JNIEnv *, jobject, jint);

/*
 * Class:     manager_NativeManager
 * Method:    stop_
 * Signature: (II)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_stop_1
  (JNIEnv *, jobject, jint, jint);

/*
 * Class:     manager_NativeManager
 * Method:    checkpoint_
 * Signature: (II)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_checkpoint_1
  (JNIEnv *, jobject, jint, jint);

/*
 * Class:     manager_NativeManager
 * Method:    split_
 * Signature: (II)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_split_1
  (JNIEnv *, jobject, jint, jint);

/*
 * Class:     manager_NativeManager
 * Method:    termination_
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_termination_1
  (JNIEnv *, jobject, jint);

#ifdef __cplusplus
}
#endif
#endif
Codice:
#include <stdlib.h>
#include <stdio.h>
#include <jni.h>
#include <string.h>
#include <signal.h>
#include "manager_NativeManager.h"

#define STOP 1
#define SUSPEND 2

int status_pipe[5][2];
int events_pipe[5][2];
int myIndex=-1;

/* FUNZIONI CHE L'UTENTE DEVE RIDEFINIRE */
extern void start_();
extern void resume_();
extern void stop_(char status[]);
extern void suspend_(char status[]);
extern void checkpoint_(char status[]);
/* split_() se lasciato vuoto dall'utente effettua la checkpoint_() */
extern void split_(char status[]);
/* FINE FUNZIONI CHE L'UTENTE DEVE RIDEFINIRE */

/* handler per il segnale di STOP e SUSPEND */
void action(int sig){
	if(sig==STOP){
		char stname[30];
		stop_(stname);
		write(status_pipe[myIndex][1],stname,sizeof(stname));
		close(status_pipe[myIndex][1]);
		close(events_pipe[myIndex][1]);
	}
	else if(sig==SUSPEND){
		char stname[30];
		suspend_(stname);
		write(status_pipe[myIndex][1],stname,sizeof(stname));
		close(status_pipe[myIndex][1]);
		close(events_pipe[myIndex][1]);
	}
		exit(sig);
}

/* handler per il segnale di CHEKPOINT e SPLIT */
void check_split_Handler(int sig){
	if(sig==SIGRTMIN){
		char stname[30];
		checkpoint_(stname);
		write(status_pipe[myIndex][1],stname,sizeof(stname));
		signal(SIGRTMIN,check_split_Handler);
	}
	else if(sig==SIGRTMIN+1){
		char stname[30],temp[30];
		strcpy(temp,stname);
		split_(stname);
		if(strcmp(temp,stname)==0){
			checkpoint_(stname);
		}
		write(status_pipe[myIndex][1],stname,sizeof(stname));
		signal(SIGRTMIN+1,check_split_Handler);
	}
}

/* handler per il segnale di terminazione del task */
void terminationHandler(int sig){
	if(sig==SIGUSR1){
		int terminated=1;
		write(events_pipe[myIndex][1],&terminated,sizeof(int));
		signal(SIGUSR1,terminationHandler);
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    start_
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_start_1 (JNIEnv *env, jobject obj, jint index){
	pipe(status_pipe[index]);
	pipe(events_pipe[index]);
	int pid=fork();
	if(!pid){
		signal(STOP,action);
		signal(SUSPEND,action);
		signal(SIGRTMIN,check_split_Handler);
		signal(SIGRTMIN+1,check_split_Handler);
		signal(SIGUSR1,terminationHandler);
		myIndex=index;
		close(status_pipe[index][0]);
		close(events_pipe[index][0]);
		start_();
	}
	else {
		close(status_pipe[index][1]);
		close(events_pipe[index][1]);
		return pid;
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    resume_
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_resume_1
(JNIEnv *env, jobject obj, jint index){
	pipe(status_pipe[index]);
	pipe(events_pipe[index]);
	int pid=fork();
	if(!pid){
		signal(SUSPEND,action);
		signal(STOP,action);
		signal(SIGRTMIN,check_split_Handler);
		signal(SIGRTMIN+1,check_split_Handler);
		signal(SIGUSR1,terminationHandler);
		myIndex=index;
		close(status_pipe[index][0]);
		close(events_pipe[index][0]);
		resume_();
	}
	else {
		close(status_pipe[index][1]);
		close(events_pipe[index][1]);
		return pid;
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    stop_
 * Signature: (I)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_stop_1
(JNIEnv *env, jobject obj, jint app_pid, jint index){
	if(app_pid>0){
		kill(app_pid,STOP);
		char status[30];
		read(status_pipe[index][0],status,sizeof(status));
		close(status_pipe[index][0]);
		close(events_pipe[index][0]);
		return (*env)->NewStringUTF(env,status);
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    suspend_
 * Signature: (I)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_suspend_1
(JNIEnv *env, jobject obj, jint app_pid, jint index){
	if(app_pid>0){
		kill(app_pid,SUSPEND);
		char status[30];
		read(status_pipe[index][0],status,sizeof(status));
		close(status_pipe[index][0]);
		close(events_pipe[index][0]);
		return (*env)->NewStringUTF(env,status);
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    checkpoint_
 * Signature: (I)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_checkpoint_1
(JNIEnv *env, jobject obj, jint app_pid, jint index){
	if(app_pid>0){
		kill(app_pid,SIGRTMIN);
		char status[30];
		read(status_pipe[index][0],status,sizeof(status));
		return (*env)->NewStringUTF(env,status);
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    split_
 * Signature: (II)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_manager_NativeManager_split_1
(JNIEnv *env, jobject obj, jint app_pid, jint index){
	if(app_pid>0){
		kill(app_pid,SIGRTMIN+1);
		char status[30];
		read(status_pipe[index][0],status,sizeof(status));
		return (*env)->NewStringUTF(env,status);
	}
}

/*
 * Class:     manager_NativeManager
 * Method:    termination_
 * Signature: (I)I
 */
JNIEXPORT jint JNICALL Java_manager_NativeManager_termination_1
(JNIEnv *env, jobject obj, jint index){
	int terminated=-1;
	read(events_pipe[index][0],&terminated,sizeof(int));
	return terminated;
}
Il manager nativo .c va a riferirsi a delle funzioni di un altra classe .c.
Quando vado a compilare il manager nativo .c mi da questi errori:

gcc NativeManager.c -I /usr/java/jdk1.6.0_16/include/ -I /usr/java/jdk1.6.0_16/include/linux/

Codice:
usr/lib/gcc/i586-manbo-linux-gnu/4.3.2/../../../crt1.o: In function `_start':
/home/mandrake/rpm/BUILD/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
/home/ermasto/tmp/ccRafG0k.o: In function `action':
NativeManager.c:(.text+0x13): undefined reference to `stop_'
NativeManager.c:(.text+0x80): undefined reference to `suspend_'
/home/ermasto/tmp/ccRafG0k.o: In function `check_split_Handler':
NativeManager.c:(.text+0x100): undefined reference to `checkpoint_'
NativeManager.c:(.text+0x16c): undefined reference to `split_'
NativeManager.c:(.text+0x18d): undefined reference to `checkpoint_'
/home/ermasto/tmp/ccRafG0k.o: In function `Java_manager_NativeManager_start_1':
NativeManager.c:(.text+0x2fe): undefined reference to `start_'
/home/ermasto/tmp/ccRafG0k.o: In function `Java_manager_NativeManager_resume_1':
NativeManager.c:(.text+0x417): undefined reference to `resume_'
collect2: ld returned 1 exit status
Da cosa dipende quest'errore sbaglio qualcosa nel codice di compilazione??
Grazie per l'aiuto
__________________
Toshiba M40-281
ermasto ่ offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Samsung Micro RGB R95H, il primo LCD a LED rossi, verdi e blu di Samsung alla prova del banco di misura Samsung Micro RGB R95H, il primo LCD a LED rossi...
iPhone 18 Pro: la recensione del miglior iPhone compatto di sempre iPhone 18 Pro: la recensione del miglior iPhone ...
Panasonic, 30 anni di Toughbook: la "Bibbia" di mille regole dietro i nuovi G3 e 34 Panasonic, 30 anni di Toughbook: la "Bibbia...
realme C100x, lo smartphone economico con la batteria da 7500 mAh. La recensione realme C100x, lo smartphone economico con la bat...
Star Wars Zero Company è l'erede di XCOM 2 Star Wars Zero Company è l'erede di XCOM ...
Il miglior tablet delle offerte Prime? E...
SSD sempre più costosi? YMTC lanc...
Google Pixel 12, un leak svela i numeri ...
Scrive a Claude di voler sparare alla po...
Apple vuole rafforzare la privacy di mac...
Neuralink sfida mouse e tastiera: il cur...
Al via le offerte Amazon Prime e tutte l...
Prime Day e Amazon Seconda Mano: sconto ...
Cuffie e auricolari in offerta Prime Day...
Prime day: 7 mini PC in super sconto da ...
Scope elettriche e lavapavimenti Prime D...
Smartphone Prime Day: le migliori occasi...
Microsoft 365 Family in offerta Prime Da...
E-bike in offerta Prime Day: HillMiles e...
Prime Day TV: OLED LG B6E 65'' a 1.299€,...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB ่ On
Le Faccine sono On
Il codice [IMG] ่ On
Il codice HTML ่ Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 07:20.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v