webutil...........dll..........problem
Hello every body
I have a problem with webutil in oracle 10g. Actually I want to use webutil to call a method in a dll file.
Code of my dll is like below:
#include <stdio.h>
#include <string.h>
extern "C"
{
__declspec( dllexport ) int PS (int *BuffLen)
{
int LocalLength;
LocalLength = 14;
return LocalLength;
}
}
And in my form:
declare
StringBuffer varchar2(255) := 'overwritten';
StringLength pls_integer := length(StringBuffer);
rc pls_integer;
f_handle WEBUTIL_C_API.FUNCTIONHANDLE;
args Webutil_c_api.parameterlist;
param1 Webutil_c_api.ParameterHandle;
param2 Webutil_c_api.ParameterHandle;
test varchar2(255);
begin
message('Before Calling the C program the value of the string is:"'||
StringBuffer||'" with a length of '||to_char(StringLength));
f_handle := WEBUTIL_C_API.register_function('simple.dll','PS');
args := WEBUTIL_C_API.create_parameter_list;
param1 := WEBUTIL_C_API.add_parameter(args,WEBUTIL_C_API.C_int_PTR
,WEBUTIL_C_API.PARAM_INOUT
,StringLength);
rc := WEBUTIL_C_API.Invoke_Int('simple.dll','PS',args);
rc := webutil_c_api.Get_Parameter_Number(args, param1);
WEBUTIL_C_API.Destroy_Parameter_List(args);
message('RC was '||to_char(RC));
WEBUTIL_C_API.Destroy_Parameter_List(args);
WEBUTIL_C_API.Deregister_Function(f_handle);
end;
I put my dll file in <oracle_home>/forms/webutil. And also I wrote line below to set my dll as an user library.
install.syslib.0.user.1=simple.dll|45056|1.0|true
I could use webutil demo and also ffsamp.dll. So this means that I configs webutil compeletly and it works. But I don't what is wrong. I can't use my own dll any way. :(
Another thing that I test to run out of my problem was replacing the
install.syslib.location=/webutil
with
install.syslib.location=http://[host]:[port]/forms/webutil
in the webutil.cfg file. But it doesn't meke any difference.
I got these erorrs:
WUL-928 [CApiFunctions.register_function()]
WUL-928 [CApiFunctions.set_invokeoncespec()]
WUL-910 [CApiFunctions.invokeCApi()]
I can use ffsamp.ddl and demo but ffsamp should have a method like:
#include <stdio.h>
#include <string.h>
extern "C"
{
__declspec( dllexport ) int PopulateString ( char FormsBuffer, int BuffLen)
{
//Simple C function that just puts something in a string
// and returns the length of that string both as the RC and as a param
// Keeping the C interface as simple as possible.
int LocalLength;
strcpy(FormsBuffer,"A Fixed string from within the C program");
*BuffLen = strlen(FormsBuffer);
LocalLength = strlen(FormsBuffer);
return LocalLength;
}
}
But if I built this code as my own dll , it doesn't work anymore.
It really upsets me. Any help is really really apreciated.
thanks