Stdcall Calling Convention
This example is standard code for Windows programs and is not specific to JD Edwards EnterpriseOne software:
# ifdef JDENV_PC HINSTANCE hLibrary = LoadLibrary(_TEXT(YOUR_LIBRARY.DLL)); // substitute the name⇒ of the external dll if(hLibrary) { // create a typedef for the function pointer based on the parameters and return⇒ type of the function to be called. This information can be obtained // from the header file of the external dll. The name of the function to be called⇒ in the following code is StartInstallEngine. We create a typedef for // a function pointer named PFNSTARTINSTALLENGINE. Its return type is BOOL. Its⇒ parameters are HUSER, LPCTSTR, LPCTSTR, LPTSTR & LPTSTR. // Substitute these with parameter and return types for the particular API. typedef BOOL (*PFNSTARTINSTALLENGINE) (HUSER, LPCTSTR, LPCTSTR, LPTSTR, LPTSTR); // Now create a variable for the function pointer of the type you just created.⇒ Then make call to GetProcAddress function with the first // parameter as the handle to the library you just loaded. The second parameter⇒ should be the name of the function you want to call prepended // with an _, and appended with an @ followed by the total number of bytes for the⇒ parameters. In this example, the total number of bytes in the // parameters for StartInstallEngine is 20 ( 4 bytes for each parameter ). The Get⇒ ProcAddress API will return a pointer to the function that you need to // call. PFNSTARTINSTALLENGINE lpfnStartInstallEngine = (PFNSTARTINSTALLENGINE) GetProc⇒ Address(hLibrary, _StartInstallEngine@20); if ( lpfnStartInstallEngine ) { // Now call the API by passing in the requisite parameters. lpfnStartInstallEngine(hUser, szObjectName, szVersionName, pszObjectText, szObject⇒ Type); } #endif