Calling BSFN from C++

stp43

Member
Trying to create a console application to execute a business function call. Test executing GetAuditInfo and hitting Access violation reading location ... in jdekrnl.dll.

Here's what I have currently.
result = JDB_InitEnvOvrExtended(&hEnv, (JCHAR *)&e1Env, (JCHAR *)&e1User, (JCHAR *)&e1Pwd, (JCHAR *)&e1Role);
if (result != JDEDB_PASSED)
{
printf("JDB_InitEnv failed. Error code: %d\n", result);
return 0;
}

if (JDB_InitUser(hEnv, &hUser, NULL, JDEDB_COMMIT_AUTO) != JDEDB_PASSED)
{
printf("JDE_InitUser failed.\n");
JDB_FreeEnv(hEnv);
return 0;
}

if (jdeCreateBusinessFunctionParms(&hUser, &lpBhvrCom, (LPVOID *)&lpVoid) != JDEDB_PASSED) {
printf("jdeCreateBusinessFunctionParms failed.\n");
JDB_FreeEnv(hEnv);
return 0;
}

memset((void *)&dsUpdateInfo, (int)_J('\0'), sizeof(DSD9800100));

ID returnValue = jdeCallObject((JCHAR *)_J("GetAuditInfo"), NULL, lpBhvrCom, lpVoid, &dsUpdateInfo, (LPCALLMAP)NULL, (int)0, (JCHAR *)NULL, (JCHAR *)NULL, (int)0);

Error occurs on jdeCallObject... Not sure what the issue is. I'm able to execute a UBE using jdeLaunchUBEEx2. But fail when using jdeCallObject.

Any help is appreciated.
 
Don't pass the address of hUser (&hUser), just hUser.

if (jdeCreateBusinessFunctionParms(hUser, &lpBhvrCom, (LPVOID *)&lpVoid) != JDEDB_PASSED) {

 
Hitting another issue. Trying to query from a table using jdeOpenTable... which is expanded to jdeOpenTableX with arguments type incompatible.
 
Sorry. Yes. I meant JDB_OpenTable.

ID jdbReturn = JDB_OpenTable(hUser, NID_F5544H01, (ID)0, nidF5544H01, (ushort)2, (JCHAR *)NULL, (HREQUEST)&hF5544H01Request);

source.cpp(161): warning C4302: 'type cast': truncation from 'const wchar_t *' to 'JCHAR'
source.cpp(161): fatal error C1001: An internal error has occurred in the compiler.
 
I believe the (HREQUEST) cast s/b (HREQUEST *). Honestly you should omit the cast as it is unnecessary. Don't know if that is the problem though. You should probably also fix your compiler warning as well.
 
Back
Top Bottom