%1 is not a valid Win32 application
{ message edit: Code:
// Error 42: Symbol Undefined _UnlockData
zarf Zarf=new zarf("test_run.dat"));
try
{
if(Zarf.imageUpdate())
{
java.lang.System.out.println(new java.lang.String("returning from main ...."));//
return;
}
}
}
catch(java.lang.Throwable t)
{
java.lang.System.out.println(new java.lang.String("load failed ...."));//
java.lang.System.out.println(t.getMessage());
return;
}
.... prints: zarfOCR.dll: %1 is not a valid Win32 application
completely re-wote zarfOCR.def and all the linker switches since I posted this morning
Had to run a tool on the import lib to get it in the format expected by compiler, the above link error is the only thing left before maybe it will load.
}
Quote:
Originally Posted by
toadaly
You should be casting imageMemoryReference (which should be a native array type such as signed char*) to a jbyte*, not a _jbyteArray. Also, don't forget to call ReleaseByteArrayElements at some point, so that the changes you made will be reflected on the java side. If you fail to do that, you'll have a heck of a time trying to figure out why the byte[] on the java side is always full of 0's.
made suggested change of making the cast to a pointer to an object type - rather than object without the "*" - still working on how to do the pointers as there are linker errors I need to find. I will be working on that momentarily, how do we do pointers? can I just declare what I want to be linked as 32-bit flat address space as being void* and just do casting and so on as need be? ( I know about putting the pointer back at the beginning of the offset - simple, obvious pre-intro stuff for a mechanic )
Code:
static jmethodID DataBufferByteConstructor=NULL;
// 2
jclass localRefzarfObject=(*JEnvironmentPointer)->GetObjectClass(JEnvironmentPointer, jayObject);
//
jclass localRefDataBufferIntClass =(*JEnvironmentPointer)->FindClass(JEnvironmentPointer,"[I");//
//
jclass localRefDataBufferByteClass =(*JEnvironmentPointer)->FindClass(JEnvironmentPointer,"Ljava/awt/image/DataBufferByte;");//
DataBufferByteConstructor=(*JEnvironmentPointer)->GetMethodID(JEnvironmentPointer,localRefDataBufferByteClass,"<init>","([B,I)V");
//
jfieldID localRefzarfMemberVar_1=(*JEnvironmentPointer)->GetStaticFieldID(JEnvironmentPointer,localRefzarfObject,"availablity","I");
//
jfieldID localRefzarfMemberVar_2=(*JEnvironmentPointer)->GetStaticFieldID(JEnvironmentPointer,localRefzarfObject,"dataLength" ,"I");
//
jfieldID localRefzarfMemberVar_3=(*JEnvironmentPointer)->GetStaticFieldID(JEnvironmentPointer,localRefzarfObject,"imageX","I");
//
jfieldID localRefzarfMemberVar_4=(*JEnvironmentPointer)->GetStaticFieldID(JEnvironmentPointer,localRefzarfObject,"imageY" ,"I");
//
jfieldID localRefzarfMemberVar_5=(*JEnvironmentPointer)->GetStaticFieldID(JEnvironmentPointer,localRefzarfObject,"dataBlock","[I");//private static volatile int [] dataBlock=new int[(64 / 4)];//localRefzarfMemberVar_5
//
jfieldID localRefzarfMemberVar_6=(*JEnvironmentPointer)->GetFieldID(JEnvironmentPointer,localRefzarfObject,"byteArray","[B");
//
fieldID localRefzarfMemberVar_7=(*JEnvironmentPointer)->GetFieldID(JEnvironmentPointer,localRefzarfObject,"dataBufferByte","Ljava/awt/image/DataBufferByte;");
//set some fields"
(*JEnvironmentPointer)->SetStaticIntField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_1,availability);//
//set some fields"
(*JEnvironmentPointer)->SetStaticIntField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_2,image_size);//
//set some fields"
(*JEnvironmentPointer)->SetStaticIntField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_3,image_width);//
//set some fields"
(*JEnvironmentPointer)->SetStaticIntField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_4,image_height);//
////****////****////
jintArray StaticIntArrayField=(jintArray)(*JEnvironmentPointer)->GetStaticObjectField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_5);
jbyteArray StaticByteArrayField=(jbyteArray)(*JEnvironmentPointer)->GetStaticObjectField(JEnvironmentPointer,localRefzarfObject,localRefzarfMemberVar_6);
jsize StaticIntArraySize=(jsize)(*JEnvironmentPointer)->GetArrayLength(JEnvironmentPointer,StaticIntArrayField);
jsize StaticByteArraySize=(jsize)(*JEnvironmentPointer)->GetArrayLength(JEnvironmentPointer,StaticByteArrayField);
jboolean isCopyPointer='\0';//
void * StaticIntArrayFieldPointer=(*JEnvironmentPointer)->GetPrimitiveArrayCritical((JNIEnv*)JEnvironmentPointer,(jarray)StaticIntArrayField,(jboolean*)&isCopyPointer);// jboolean
// - check for null pointers
if((StaticIntArrayFieldPointer != (void *) NULL)&&(buffer64 != (int *)NULL))
{
memcpy((void *)StaticIntArrayFieldPointer,(void*)buffer64,StaticIntArraySize);
(*JEnvironmentPointer)->ReleasePrimitiveArrayCritical((JNIEnv *)(JEnvironmentPointer),(jarray*)StaticIntArrayFieldPointer,(void*)buffer64,(jint)0x00000000);
// ... wow,
}
else
{
return (jbyteArray) imageMemoryReference;
}
////****////****////
void * StaticByteArrayFieldPointer=(*JEnvironmentPointer)->GetPrimitiveArrayCritical((JNIEnv*)JEnvironmentPointer,(jarray*)StaticByteArrayField,(jboolean * )isCopyPointer);// jboolean
// - check for null pointers
if((StaticByteArrayFieldPointer != (void *) NULL)&&(buffer64 != (int *)NULL))
{
memcpy((void *)StaticByteArrayFieldPointer,(void*)imageMemoryReference,StaticByteArraySize);
(*JEnvironmentPointer)->ReleasePrimitiveArrayCritical((JNIEnv *)(JEnvironmentPointer),(jarray)StaticByteArrayFieldPointer,(void*)buffer64,(jint)0x00000000);
// ... wow,
}
else
{
return (jbyteArray) imageMemoryReference;
}
// Run constructor on dataBufferByte
////****////****////
jobject CdataBufferByte=(*JEnvironmentPointer)->AllocObject((JNIEnv *)JEnvironmentPointer,(jclass)localRefDataBufferByteClass);
jmethodID dataBufferByteConstructorID=(jmethodID)(*JEnvironmentPointer)->GetMethodID(JEnvironmentPointer,CdataBufferByte,"<init>","([B,I)V");
(*JEnvironmentPointer)->CallVoidMethod(JEnvironmentPointer,CdataBufferByte,dataBufferByteConstructorID,(jbyteArray)imageMemoryReference,(jsize)image_size);
(*JEnvironmentPointer)->SetStaticObjectField(JEnvironmentPointer,CdataBufferByte,localRefzarfMemberVar_7,CdataBufferByte);//
// end image ops
return (jbyteArray)imageMemoryReference;
DataBufferByte constructor is running on the c side
I stripped out the extern "C" and ( I think ) am writing in c not cpp - I had set a compiler switch but "-c" but that was something else { the switch "-cpp" turns on cpp for non cpp extensions ... I named all compilation units filename.c which is mapped to the c compiler in the build shell } I will be working on the dib stuff exclusively today, as soon as I get that I can get into ai/ocr as I think the DataBufferByte constructor is running on the c side Code:
////****////****////
long const offset_to_image=(header_size+256);
//
unsigned char * base__bitMapHandle=(unsigned char *)pBitmapInfoPointer;
if(base__bitMapHandle != NULL )
{
signed char const * base_of_copy=(signed char const *)( base__bitMapHandle + header_size + 256 );
jsize base_1=image_size;//
jsize jayImageSize=(long)base__bitMapHandle;//
jbyteArray jayByteArray=(*JEnvironmentPointer)->NewByteArray(JEnvironmentPointer,jayImageSize);
(*JEnvironmentPointer)->SetByteArrayRegion(JEnvironmentPointer,jayByteArray,jayZero,jayImageSize,base_of_copy);
////****////****////
// Run constructor on dataBufferByte
jclass localRefDataBufferByteClass=(*JEnvironmentPointer)->FindClass(JEnvironmentPointer,"Ljava/awt/image/DataBufferByte;");//
jobject CdataBufferByte=(*JEnvironmentPointer)->AllocObject(JEnvironmentPointer,localRefDataBufferByteClass);
jmethodID dataBufferByteConstructorID=(*JEnvironmentPointer)->GetMethodID(JEnvironmentPointer,localRefDataBufferByteClass,"<init>","([B,I)V");
(*JEnvironmentPointer)->CallVoidMethod(JEnvironmentPointer,CdataBufferByte,dataBufferByteConstructorID,jayByteArray,jayImageSize);
(*JEnvironmentPointer)->SetStaticObjectField(JEnvironmentPointer,localRefDataBufferByteClass ,localRefzarfMemberVar_11,CdataBufferByte);//
// end image ops
jint const good=0xffff;
return good;
}
else
{
return fail__;
}
I do not have any idea how to detemine the length of the pallete, notably whether it is even there. The header length is given in the dib header, then it is narrowly pointer arithmetic - which is not hard - code archaeology on what the compiler is doing is dicey at best for me.
0x0022566 + offset == where it should point, all I see is pointy head pencils as far as .....
maybe we should name this tool: "Horizons" ( folks, this todaly guy is smart - he will grasp what I am doing with this byte bite ) maybe we could require all source code to be underlined as a tribute to the body of code at the body farm.
reference to getPixels is ambiguous
Code:
TrainingSet.java:40: reference to getPixels is ambiguous, both method getPixels(int,int,int,int,float[]) in java.awt.image.Raster and method getPixels(int,int,int,int,double[]) in java.awt.image.Raster match
Back to same thing, code expects image to be supplied - not examined. ( I think )
{ message edit: I am looking at something from softwarepearls_com that may do it.}