Home » Developer & Programmer » Forms » ORA_FFI PROBLEM & DLL file written in C (merged)
ORA_FFI PROBLEM & DLL file written in C (merged) [message #174366] Sun, 28 May 2006 12:16 Go to next message
Lama
Messages: 45
Registered: February 2006
Member
Hi all,
Am trying to read a C dll file using ora_ffi , and I tried everything but it I couldnt read the c function , please any help will be appreciated...here is the code am using :

----------------------------------------------------------

PACKAGE sms IS

procedure SetServer (v_server varchar);
procedure SetPort (v_port number);
procedure SetUser (v_user varchar) ;
procedure SetPassword (v_password varchar);
procedure login;
procedure SendMsg(v_msg varchar,v_num number,v_lang number, v_company varchar, v_date varchar);
procedure logout;
END;

----------------------------------------------------------
PACKAGE BODY sms IS

sms_lhandle Ora_Ffi.Libhandletype ;

SetServer_fhandle Ora_Ffi.Funchandletype ;
Setport_fhandle Ora_Ffi.Funchandletype ;
Setuser_fhandle Ora_Ffi.Funchandletype ;
SetPassword_fhandle ora_ffi.Funchandletype;
login_fhandle ora_ffi.Funchandletype;
SendMsg_fhandle ora_ffi.Funchandletype;
logout_fhandle ora_ffi.Funchandletype;

procedure ff_SetServer(fhandle ora_ffi.funchandletype, v_server varchar);
PRAGMA interface(C, ff_SetServer, 11265);

procedure ff_setPort(fhandle ora_ffi.funchandletype, v_port number);
PRAGMA interface(C, ff_setPort, 11265);

procedure ff_setUser(fhandle ora_ffi.funchandletype, v_user varchar);
PRAGMA interface(C, ff_setUser, 11265);

procedure ff_setPassword(fhandle ora_ffi.funchandletype, v_password varchar);
PRAGMA interface(C, ff_setPassword, 11265);

procedure ff_login(fhandle ora_ffi.funchandletype);
PRAGMA interface(C, ff_login, 11265);

procedure ff_send_msg(fhandle ora_ffi.funchandletype,v_msg varchar,v_num number,v_lang number, v_company varchar, v_date varchar);
PRAGMA interface(C, ff_send_msg, 11265);

procedure ff_logout(fhandle ora_ffi.funchandletype);
PRAGMA interface(C, ff_logout, 11265);

-----------------------------------------------------------------------procedures

procedure SetServer (v_server varchar) IS
BEGIN
ff_SetServer(SetServer_fhandle,v_server) ;
END SetServer;

procedure setPort (v_port number) IS
BEGIN
ff_setPort(setPort_fhandle,v_port) ;
END setPort;


procedure setUser (v_user varchar) IS
BEGIN
ff_setUser(setUser_fhandle,v_user) ;
END setUser;

procedure setPassword (v_password varchar) IS
BEGIN
ff_setPassword(setPassword_fhandle,v_password) ;
END setPassword;

procedure login IS
BEGIN
ff_login(login_fhandle) ;
END login;

procedure SendMsg (v_msg varchar,v_num number,v_lang number, v_company varchar, v_date varchar) IS
BEGIN
ff_send_msg(SendMsg_fhandle,v_msg ,v_num,v_lang, v_company, v_date);
END sendmsg;

procedure logout IS
BEGIN
ff_logout(logout_fhandle) ;
END logout;



--------------------------------------------------------------------------------------
begin

sms_lhandle := Ora_Ffi.Load_Library('C:\', 'SmsPro.dll');

SetServer_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'SetServer', Ora_Ffi.C_Std);
Ora_Ffi.Register_Parameter (SetServer_fhandle,Ora_Ffi.C_char);

SetPort_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'SetPort', Ora_Ffi.C_Std);
Ora_Ffi.Register_Parameter (SetPort_fhandle,Ora_Ffi.C_Int);

SetUser_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'Set_User', Ora_Ffi.C_Std);
Ora_Ffi.Register_Parameter (SetUser_fhandle,Ora_Ffi.C_char);

SetPassword_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'SetPassword', Ora_Ffi.C_Std);
Ora_Ffi.Register_Parameter (SetPassword_fhandle,Ora_Ffi.C_char);



login_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'login', Ora_Ffi.C_Std);


Ora_Ffi.Register_Parameter (login_fhandle,Ora_Ffi.C_char);


SendMsg_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'SendMsg', Ora_Ffi.C_Std);

Ora_Ffi.Register_Parameter (SendMsg_fhandle,Ora_Ffi.C_Char);
Ora_Ffi.Register_Parameter(SendMsg_fhandle,Ora_Ffi.C_int);
Ora_Ffi.Register_Parameter(SendMsg_fhandle,Ora_Ffi.c_int);
Ora_Ffi.Register_Parameter(SendMsg_fhandle,Ora_Ffi.c_char);
Ora_Ffi.Register_Parameter(SendMsg_fhandle,Ora_Ffi.c_char);

logout_fhandle := Ora_Ffi.Register_Function(sms_lhandle, 'logout', Ora_Ffi.C_Std);
Ora_Ffi.Register_Parameter(logout_fhandle,Ora_Ffi.C_char);
EXCEPTION
WHEN Ora_Ffi.Ffi_Error THEN
/* print error message */
message(tool_err.message);
message(tool_err.message);
tool_err.pop;

END;


-----------
Ive got this message when tring to run sms.login;
--> no function login in smspro package
Re: ORA_FFI PROBLEM [message #174522 is a reply to message #174366] Mon, 29 May 2006 07:59 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I suggest that, at least during the debug phase, you display ALL the return codes you get from your function calls, starting with sms_lhandle. Are you getting a non-zero return value?

Use a hex editor or one of those C tools and make sure that there is a function 'login' and that it isn't 'Login'.

David
Re: ORA_FFI PROBLEM [message #174564 is a reply to message #174366] Mon, 29 May 2006 13:15 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
The thing is,
a company wants to send sms from oracle , and they send me a dll file which is written by another company (in C , so i can use the functions in it to send data in msgs from oracle DB) , and they send me the dll file along with the names of the functions in it ,I checked with them many and they are sure of the function names and spelling...I tried everything for 2 weeks without a solution and it keeps giving me 'function not found in library' !!! Please HHHHHHHHeeeeeeeeeelllllllllllppppppppppppp
Re: ORA_FFI PROBLEM [message #174583 is a reply to message #174564] Mon, 29 May 2006 20:22 Go to previous messageGo to next message
lomhanz
Messages: 18
Registered: May 2005
Location: Cebu, Philippines
Junior Member

hello lama,

you know, its very much easier to use the dll in vb. i suggest you do it in vb instead of using it directly from oracle, though its still possible because of ora_ffi pkg.

i already tried using that, what i did, i made an ocx in vb and attached it in my oracle forms.

good luck.

lomhanz.
Re: ORA_FFI PROBLEM [message #174764 is a reply to message #174564] Tue, 30 May 2006 08:40 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I asked two questions - you answered neither.

David
Re: ORA_FFI PROBLEM [message #174853 is a reply to message #174366] Tue, 30 May 2006 15:21 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
Ok I'll tell them to re-write the code in vb (but why is it easier using VB ),
but anyway, is there sth wrong with the code... and am not that good in c , so if am writing a dll that i want to call in oracle forms , should it be in specific format ?
Re: ORA_FFI PROBLEM [message #175229 is a reply to message #174853] Thu, 01 June 2006 06:37 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Final contact ... have you looked at the dll with a flat editor ... is the 'login' actually spelt 'Login'? Have you displayed the return codes?

David
Re: ORA_FFI PROBLEM [message #175458 is a reply to message #175229] Fri, 02 June 2006 05:48 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
Yeh am sure from the spelling, anyway We're trying to write the code using .net... I just wanted to know what is wrong with this code? can anyone send me a code written in c and the code that would be used if you want to read that code from oracle?
Appreciate all your help.
Re: ORA_FFI PROBLEM [message #175475 is a reply to message #175458] Fri, 02 June 2006 07:41 Go to previous messageGo to next message
fahedakhter
Messages: 39
Registered: March 2005
Location: Pakistan
Member

You should use FFIGEN form to saw the function in Dll file and then make Pll file. I Use Dll file written in C Language in Oracle Developer and its work fine.If u provide me Dll file I can help u to convert this file in .Pll file.
Re: ORA_FFI PROBLEM [message #175545 is a reply to message #174366] Fri, 02 June 2006 13:28 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
I tried to use ffigen , but also didn't succeed ... Anyway, attached is the dll file along with the functions :
Class Name:

CSmspro



DLL Functions:

1- STDMETHODIMP CCSmspro::login()

2- STDMETHODIMP CCSmspro::logout()

3- STDMETHODIMP CCSmspro::SendMsg(BSTR msg, BSTR mobile, BOOL isar, BSTR sender, BSTR schedule)

4- STDMETHODIMP CCSmspro::SetPassword(BSTR pass)

5- STDMETHODIMP CCSmspro::SetPort(short portNumber)

6- STDMETHODIMP CCSmspro::SetServer(BSTR strServer)

7- STDMETHODIMP CCSmspro::SetUser(BSTR strUser)
  • Attachment: SmsPro.dll
    (Size: 124.00KB, Downloaded 561 times)
icon8.gif  Re: ORA_FFI PROBLEM [message #175677 is a reply to message #174366] Sun, 04 June 2006 11:27 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
Hey guyz , attached is the dll file written in c and here is the functions it contains , Please I'd appreciate any help my deadline is due tommorrow Sad !!!
Class Name:

CSmspro



DLL Functions:

1- STDMETHODIMP CCSmspro::login()

2- STDMETHODIMP CCSmspro::logout()

3- STDMETHODIMP CCSmspro::SendMsg(BSTR msg, BSTR mobile, BOOL isar, BSTR sender, BSTR schedule)

4- STDMETHODIMP CCSmspro::SetPassword(BSTR pass)

5- STDMETHODIMP CCSmspro::SetPort(short portNumber)

6- STDMETHODIMP CCSmspro::SetServer(BSTR strServer)

7- STDMETHODIMP CCSmspro::SetUser(BSTR strUser)

  • Attachment: SmsPro.dll
    (Size: 124.00KB, Downloaded 416 times)
Re: ORA_FFI PROBLEM [message #175681 is a reply to message #175475] Sun, 04 June 2006 12:35 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
hey did you get my dll file
Re: ORA_FFI PROBLEM [message #175794 is a reply to message #175681] Mon, 05 June 2006 07:03 Go to previous messageGo to next message
fahedakhter
Messages: 39
Registered: March 2005
Location: Pakistan
Member

I checked your Dll File it work fine in Visual Basic Supported Applications but not in Oralce Developer because this file code is not write in C language and remember Oralce Developer Only support PASCAL/C Language file.You should try with Other Sms Dll Files.
Re: ORA_FFI PROBLEM [message #175802 is a reply to message #174366] Mon, 05 June 2006 07:39 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
I didnt't understand what you mean , Is it written in VB or C ?
Re: ORA_FFI PROBLEM [message #175827 is a reply to message #174366] Mon, 05 June 2006 10:59 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
last question: if am writing a code in visual c , does it require a specific version of Visual C for oracle to understand (using ffigen) ?
DLL file written in C [message #176064 is a reply to message #174366] Tue, 06 June 2006 13:59 Go to previous messageGo to next message
Lama
Messages: 45
Registered: February 2006
Member
Hi all,
Does oracle require a specific version of c ? I mean if I want to read a dll file written in c ,what versions of c work with the ffigen form ( which uses ora_ffi )?
Re: DLL file written in C [message #176590 is a reply to message #176064] Thu, 08 June 2006 19:35 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
@others - come on people, someone must have got their DLLs to work with Forms. Give this person the benefit of your knowledge.

Can anyone give Lama a DLL that DOES work and let him test his environment?

@Lama, can you create another DLL (mySMS) which is able to communicate with the supplied DLL (SmsPro) and then get Oracle Forms to communicate wioth your new intermediate DLL (mySMS)?

David
Re: ORA_FFI PROBLEM & DLL file written in C (merged) [message #668143 is a reply to message #174366] Thu, 08 February 2018 10:50 Go to previous message
Kokew2000
Messages: 12
Registered: December 2017
Junior Member
hello all
please im also need help i will send dll wrote by c
and here the code and want call it from oracle form 6i

const hasp_feature_t feature = 8;
hasp_handle_t handle = HASP_INVALID_HANDLE_VALUE;
hasp_status_t status;
unsigned char vendor_code[] =
"P+bvguFqumejqvwOmvNDruTN3d0v";
status = hasp_login(feature, vendor_code, &handle);
/* check if operation was successful */
if (status != HASP_STATUS_OK)
{
switch (status)
{
case HASP_FEATURE_NOT_FOUND:
break;
case HASP_HASP_NOT_FOUND:
break;
case HASP_OLD_DRIVER:
break;
case HASP_NO_DRIVER:
break;
case HASP_INV_VCODE:
break;
case HASP_FEATURE_TYPE_NOT_IMPL:
break;
case HASP_TMOF:
break;
case HASP_TS_DETECTED:
break;
default:
break;
}
}
Previous Topic: Custom EBS Form HANG
Next Topic: Need Urgent Help How to Call adf page through oracle Forms 10g
Goto Forum:
  


Current Time: Mon Jan 27 09:30:30 CST 2020