Home » Developer & Programmer » Forms » C# dll in Forms
C# dll in Forms [message #355870] Tue, 28 October 2008 04:06 Go to next message
DarkProjekt
Messages: 4
Registered: October 2008
Junior Member
Hello,

i have to use a C# dll in Oracle Forms. I use ORA_FFI to register my dll, but i get a error Message that my function can't be found in my dll (PDE-DFF004).

This is the C# dll code:

public class wae_auslesen
    { 
        public static String wae_huf(Int16 v_mon, Int16 v_year)
        {
             ...


And the code in forms, where I want to register the function:
fhandle := ORA_FFI.REGISTER_FUNCTION(get_huf_lhandle, 'wae_auslesen.wae_huf', ORA_FFI.C_STD);


Can anybody help me?

(Sorry for my bad english)
Re: C# dll in Forms [message #356231 is a reply to message #355870] Thu, 30 October 2008 01:04 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please search this forum for 'use dll'.

Is the 'dll' in the same directory as your form?

David
Re: C# dll in Forms [message #356391 is a reply to message #355870] Thu, 30 October 2008 10:43 Go to previous messageGo to next message
DarkProjekt
Messages: 4
Registered: October 2008
Junior Member
Yes, its in the same directory.

Here is the complete code:

PACKAGE BODY GET_HUF IS
  get_huf_lhandle ORA_FFI.LIBHANDLETYPE;
  to_power_fhandle ORA_FFI.FUNCHANDLETYPE;
  
  test NUMBER;
  
  FUNCTION FF_TO_POWER(fhandle ORA_FFI.FUNCHANDLETYPE, v_month NUMBER, v_year NUMBER) RETURN VARCHAR2;
  PRAGMA interface(C, ff_to_power, 11265);
  
  FUNCTION GET(v_month NUMBER, v_year NUMBER) RETURN VARCHAR2 IS
  BEGIN
  	RETURN(FF_TO_POWER(to_power_fhandle, v_month, v_year));
  END GET;
    
BEGIN
	get_huf_lhandle := ORA_FFI.LOAD_LIBRARY('','gethuf.dll');
	test := 1;
	
	to_power_fhandle := ORA_FFI.REGISTER_FUNCTION(get_huf_lhandle, 'wae_auslesen.wae_huf', ORA_FFI.C_STD);
	test := 2;
	ORA_FFI.REGISTER_PARAMETER(to_power_fhandle, ORA_FFI.C_DOUBLE);
	test := 3;
	ORA_FFI.REGISTER_PARAMETER(to_power_fhandle, ORA_FFI.C_DOUBLE);
	test := 4;
	
	ORA_FFI.REGISTER_RETURN (to_power_fhandle, ORA_FFI.C_CHAR_PTR);
	test := 5;
EXCEPTION
	WHEN Ora_FFI.FFI_ERROR THEN
		DEV_MSG(tool_err.message,1);
		tool_err.pop;
	WHEN others THEN
		DEV_MSG('PRZ: GET_HUF.GET - ' || test || '#' ||SQLERRM,1);  	
END;

[Updated on: Thu, 30 October 2008 10:46]

Report message to a moderator

Re: C# dll in Forms [message #356482 is a reply to message #356391] Thu, 30 October 2008 21:18 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What happens if you tell the 'load_library' call the name of the directory?

David
Re: C# dll in Forms [message #356548 is a reply to message #355870] Fri, 31 October 2008 02:17 Go to previous messageGo to next message
DarkProjekt
Messages: 4
Registered: October 2008
Junior Member
Sorry, same Problem. The dll is successfully opened, but the function can't be found.

/forum/fa/5228/0/
  • Attachment: error.JPG
    (Size: 9.54KB, Downloaded 1823 times)
Re: C# dll in Forms [message #356866 is a reply to message #356548] Sun, 02 November 2008 22:52 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Your function is called 'wae_auslesen.wae_huf'. How come it has a two part name?

David
Re: C# dll in Forms [message #356909 is a reply to message #355870] Mon, 03 November 2008 01:47 Go to previous messageGo to next message
DarkProjekt
Messages: 4
Registered: October 2008
Junior Member
First is the class, second the function.

But it's the same error if I call only the function.

[Updated on: Mon, 03 November 2008 01:47]

Report message to a moderator

Re: C# dll in Forms [message #357538 is a reply to message #356909] Wed, 05 November 2008 16:57 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is 'class' then 'function' standard 'C' or an extension?

David
Re: C# dll in Forms [message #357540 is a reply to message #356909] Wed, 05 November 2008 17:02 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you looked at http://www.orafaq.com/forum/m/206177/67467/?srch=REGISTER_FUNCTION#msg_206177 ?

David
Previous Topic: Changing radio button programmatically
Next Topic: character parameter in default_where property
Goto Forum:
  


Current Time: Mon Feb 03 14:48:48 CST 2025