• Welcome to the upgraded JDELIST forum and thank you for your patience.
    Please restrict discussions and issues regarding the new forum software to the Off Topic forum. We will be monitoring that forum for issues.
    If you have trouble logging in, please reset your password using the forgotten password form: https://www.jdelist.com/community/index.php?lost-password/
    If you are unable to successfully reset your password, please contact us: Click here!
    We hope that you enjoy the upgraded forum.
  • Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

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.
 

craig_welton

Legendary Poster
Don't pass the address of hUser (&hUser), just hUser.

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

 

stp43

Member
Hitting another issue. Trying to query from a table using jdeOpenTable... which is expanded to jdeOpenTableX with arguments type incompatible.
 

stp43

Member
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.
 

BOster

Legendary Poster
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.
 
Top