Trouble with JNI interface that use Microsoft COM object.
I try to call COM object from JNI code.
This is the C code:
void initializeComAPI()
{
if (!initialized)
{
OleInitialize(NULL);
// Create the RSS COM object and retrieve the default interface IID_IRSSComponent
hr = CoCreateInstance(__uuidof(RSSCOMObject), NULL, CLSCTX_ALL, IID_IRSSComponent, (void**)&pIRSSComp);
printf ("hr= %d, pIRSSComp= %d\n", hr, pIRSSComp);
if (hr != S_OK)
{
if (hr == REGDB_E_CLASSNOTREG)
{
printf ("A specified class is not registered in the registration database.\n");
}
elseif (hr == CLASS_E_NOAGGREGATION)
{
printf ("This class cannot be created as part of an aggregate.\n");
}
elseif (hr == E_NOINTERFACE)
{
printf ("The specified class does not implement the requested interface, or the controlling IUnknown does not expose the requested interface.\n");
}
}
else
{
}
// Query for the ConnectionPointContainer
//hr = pIRSSComp->QueryInterface(IID_IConnectionPointContainer,(LPVOID FAR*)&lpCPC);
// Find the event and advise
//hr = lpCPC->FindConnectionPoint(DIID__IRSSComponentEvents,&lpCPT);
//hr = lpCPT->Advise(&g_RSSEventDispatch,&dwEventCookie);
//SafeRelease(lpCPC);
}
}
JNIEXPORTvoid JNICALL Java_commons_symbology2525b_MS2525bSymbolBuilder_createSymbol
(
JNIEnv * env_p,
jclass class_p,
jstring code_p,
jstring destFilename_p)
{
if (!initialized)
{
initializeComAPI();
}
}
The java code is very simple:
publicclass MS2525bSymbolBuilder
{
static
{
System.loadLibrary("JNIRakuInteface");
}
publicstaticnativevoid createSymbol(String code_p, String filename_p);
}
We we launch this code with JDK1.4 and option -Xmx1024m, the COM object instance is well returned by the method CoCreateInstance.
If we test this code on JDK1.5 and 6.0, we can't set the option -Xmx1024m. The method CoCreateInstance returns REGDB_E_CLASSNOTREG. Without the option the COM object instance is created.
What can I do to increase the maximum JVM memory on this code.
thanks for your help !

