[HELP] Forms crashing at PLR1171W.DLL whenever attach menu

From: Tim Nguyen <tim_at_van.oz.au>
Date: 1996/08/22
Message-ID: <1996Aug22.002846.27247_at_van.oz.au>#1/1


Please help me solve this problem. This is really weird. I created a very simple form just to test out a package (see below later) that find the local machine name in Window for Workgroups environment. In that form, initially, I use a button with When-button-press trigger to call the function in the package (winsock.gethostname(name, len) ) to retrieve the hostname. It works as accordingly - even on a W95 machine.

But the trouble start when I attach a menu to the form, a very simple menu with just one Exit menuitem to exit the form. Run it and when I call the function as above , a GPF at library PLR117W.DLL. Remove the attached menu, no GPF. Reattach the menu , same GPF happens.

Any idea why it happen when the attached menu is remotely relate with the package library?

Below is the package that find the local machine name.         


PACKAGE WINSOCK IS
  FUNCTION gethostname(name IN OUT VARCHAR2, namelen IN NUMBER)

        return PLS_INTEGER;
  PROCEDURE unload ;
END;



PACKAGE BODY WINSOCK IS
  dll_handle ORA_FFI.LIBHANDLETYPE;
  fh_gethostname ORA_FFI.FUNCHANDLETYPE;

  FUNCTION ws_gethostname(handle in ORA_FFI.FUNCHANDLETYPE,

                      name in out VARCHAR2,
                      len in NUMBER) RETURN PLS_INTEGER;
  pragma interface(C, ws_gethostname, 11265);

  FUNCTION gethostname(name in out VARCHAR2, namelen IN NUMBER)   return PLS_INTEGER
  IS
  BEGIN
         return ws_gethostname(fh_gethostname, name, namelen);   END gethostname;

  procedure unload IS
  BEGIN
        ORA_FFI.UNLOAD_LIBRARY(dll_handle);
  END unload;

BEGIN
  dll_handle := ORA_FFI.REGISTER_LIBRARY(NULL, 'WINSOCK.DLL');   /* registering the function and the parameters + the return type */   fh_gethostname := ORA_FFI.REGISTER_FUNCTION(dll_handle, 'gethostname', ORA_FFI.PASCAL_STD);

  ora_ffi.register_parameter(fh_gethostname, ORA_FFI.C_CHAR_PTR);
  ora_ffi.register_parameter(fh_gethostname, ORA_FFI.C_INT);
  ora_ffi.register_return(fh_gethostname, ORA_FFI.C_INT);

  EXCEPTION
     when ora_ffi.ffi_error then 
	while tool_err.nerrors > 0 loop
		message(tool_err.message);
		tool_err.pop;
	end loop;  

END WINSOCK;

--test code for package winsock

declare

	name	varchar2(100) := 'this is the name of the workstation';
	len	pls_integer	:= 100;
	code	pls_integer;
begin
	code := winsock.gethostname(name,code);
	message(name)

end; Received on Thu Aug 22 1996 - 00:00:00 CEST

Original text of this message