Using WEBUTIL_C_API.Invoke_LONG in Forms10g it hangs [message #423925] |
Tue, 29 September 2009 05:15 |
Oras115
Messages: 3 Registered: September 2009
|
Junior Member |
|
|
Hello to all of the community,
I need your estimable help.
I am migration from Forms6i to Forms10g a package PLSQL that invoke a DLL function (iomem.dll) connect to a device printer Evolis.using ORA_FFI in 6i. The package in 6i work
In Foms10g i am making WEB_UTIL_C_API package and when it invokes to DDL function (_OpenPebble@4[/email]) the form hangs , no response and goes out no error message.
Why does it hang?
Please, could you to help me? the topic urges me.
Below I show you the code in Forms10 and in Forms6i; i notice in red the line of code of the problem in Forms10g
Thank you for your collaboration and help
---------------------------------------------------------------
---------Code Package in Forms10g---------------
---------------------------------------------------------------
PACKAGE BODY IOMEMK_WEB IS
lib_name Constant Varchar2(80) := 'iomem.dll' ;
open_func_id WEBUTIL_C_API.FUNCTIONHANDLE;
open_load_flag Boolean := False;
args_open Webutil_c_api.parameterlist;
param1_open Webutil_c_api.ParameterHandle;
FUNCTION OpenPebble(pPrinterName VARCHAR2)
RETURN BINARY_INTEGER
IS
return_value PLS_Integer;
v_printerBuffer Varchar2(512);
BEGIN
v_printerBuffer:=RTRIM(LTRIM(pPrinterName));
/*Invocamos a la función*/
IF WEBUTIL_C_API.Id_Null(open_func_id) THEN
--Registramos la función [email]_OpenPebble@4[/email] de la DLL
BEGIN
open_func_id:= WEBUTIL_C_API.register_function(lib_name, [email]'_OpenPebble@4'[/email]);
open_load_flag := True;
EXCEPTION
WHEN OTHERS THEN
open_load_flag:= False;
WEBUTIL_CORE.ErrorAlert('[[email]_OpenPebble@4[/email]] Error registrando Función '||SQLERRM);
RAISE;
END;
END IF;
--Creamos la lista de parámetros de la función
BEGIN
IF WEBUTIL_C_API.Id_Null(args_open) THEN
args_open := WEBUTIL_C_API.create_parameter_list;
END IF;
IF WEBUTIL_C_API.Id_Null(param1_open) THEN
param1_open:=WEBUTIL_C_API.add_parameter(args_open,WEBUTIL_C_API.C_CHAR_PTR,
WEBUTIL_C_API.PARAM_INOUT,v_printerBuffer,512);
ELSE
WEBUTIL_C_API.Rebind_Parameter(args_open,param1_open,v_printerBuffer);
END IF;
EXCEPTION
WHEN OTHERS THEN
open_load_flag:= False;
WEBUTIL_CORE.ErrorAlert('[[email]_OpenPebble@4[/email]] Error creando lista parámetros '||SQLERRM);
RAISE;
END;
BEGIN
[color=red] return_value:= WEBUTIL_C_API.Invoke_LONG(open_func_id,args_open); [/color]
EXCEPTION
WHEN OTHERS THEN
open_load_flag:= False;
WEBUTIL_CORE.ErrorAlert('[[email]_OpenPebble@4[/email]] Error invocando función '||SQLERRM);
RAISE;
END;
Return return_value;
EXCEPTION
WHEN OTHERS THEN
open_load_flag := False;
WEBUTIL_C_API.Destroy_Parameter_List(args_open);
WEBUTIL_CORE.ErrorAlert('[[email]_OpenPebble@4[/email]] Error '||SQLERRM);
FOR i in 1..tool_err.nerrors LOOP
WEBUTIL_CORE.ErrorAlert('[[email]_OpenPebble@4[/email]] '||tool_err.message(i-1));
END LOOP;
Return ERR_INVALID;
End;
END;
--------------------------------------------------------
----------Code Package in Forms6i-----------------------
--------------------------------------------------------
PACKAGE BODY IOMEMK IS
lib_name Constant Varchar2(80) := 'iomem.dll' ;
lib_id Ora_FFI.LibHandleType;
open_func_id Ora_FFI.FuncHandleType;
open_load_flag Boolean := False;
Function R_open(func_id In Ora_FFI.FuncHandleType,pPrinterName IN OUT VARCHAR2) RETURN PLS_INTEGER;
PRAGMA INTERFACE(C, R_open, 11265);
FUNCTION OpenPebble(pPrinterName VARCHAR2)
RETURN BINARY_INTEGER
IS
return_value PLS_Integer;
v_printerBuffer Varchar2(4096);
BEGIN
If Not close_load_flag Then
Return ERR_INVALID;
End If;
v_printerBuffer:=RTRIM(LTRIM(pPrinterName));
/**/
return_value := R_open(open_func_id,v_printerBuffer);
/**/
Return return_value;
End;
BEGIN
Begin
lib_id := Ora_FFI.Find_Library(lib_name);
Exception
When Ora_FFI.FFI_Error Then
lib_id := Ora_FFI.Load_Library(p_dir, lib_name);
Begin
open_func_id := Ora_FFI.Register_Function(lib_id, [email]'_OpenPebble@4'[/email], Ora_FFI.C_STD);
Ora_FFI.Register_Return(open_func_id, Ora_FFI.C_LONG); /*HANDLE*/
Ora_FFI.Register_Parameter(open_func_id, ORA_FFI.C_CHAR_PTR); /*DriverName*/
open_load_flag := True;
Exception
When Ora_FFI.FFI_Error Then
open_load_flag := FALSE;
RAISE;
End;
EXCEPTION /* Generic FFI Error Handler to unwind the TOOL_ERR stack */
when others then
open_load_flag:= False;
close_load_flag:= False;
read_load_flag:= False;
write_load_flag:= False;
message('Error Carga librería '||p_dir||lib_name||': '||SQLERRM);
message('Error Carga librería '||p_dir||lib_name||': '||SQLERRM);
for iCounter in 1..tool_err.nerrors LOOP
message(tool_err.message);
tool_err.pop;
end loop;
RETURN 0;
END; [EDITED by DJM: add [code] tags]
[Updated on: Mon, 12 October 2009 01:21] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: Using WEBUTIL_C_API.Invoke_LONG in Forms10g it hangs [message #428075 is a reply to message #428046] |
Tue, 27 October 2009 02:53 |
Oras115
Messages: 3 Registered: September 2009
|
Junior Member |
|
|
Hi djmartin,
No, I have not tried using DDE Packing.
I would thank you that showed me how to use DDE package instead of Webutil_C_API package with a dll library ,for example, in the
the code in Forms10 (PACKAGE BODY IOMEMK_WEB) or in Forms6i
(PACKAGE BODY IOMEMK) of the Post.
xpecting your suggestions, thank you very much for your attention.
|
|
|
|