Home » SQL & PL/SQL » SQL & PL/SQL » Return structure from DLL to PL/SQL
Return structure from DLL to PL/SQL [message #186253] Mon, 07 August 2006 03:20 Go to next message
nvd077
Messages: 6
Registered: July 2006
Junior Member
I have a function in DLL which return a pointer to a C Structure. How can I register such function in pl/sql?

C structure is like this:
typedef struct myStruct
{
char* p1;
char* p2;
} myStruct;

The DLL function is like this:
long myFunction (char* pValue, myStruct *datas);

how to register such function????
I don't have source code of DLL !!!

please for help

best regards
Re: Return structure from DLL to PL/SQL [message #186311 is a reply to message #186253] Mon, 07 August 2006 07:33 Go to previous messageGo to next message
wagnerch
Messages: 58
Registered: July 2006
Member
You have a library that you would like to make a native PL/SQL function, right?

I have never done this before, but naturally this functions interface doesn't line up with the Oracle specified interface via OCI. You would need to write a "wrapper", which is more or less a piece of code that bridges the Oracle OCI interface to the native library. The DLL that you write would be dependent on the vendor supplied library, and when Oracle loads your DLL the dynamic loader should pull in the dependent objects without an issue as long as they can be located.

Here is some information on building a native PL/SQL function:

http://download-west.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88876/adg11rtn.htm#997854


Good luck.
Re: Return structure from DLL to PL/SQL [message #186659 is a reply to message #186253] Tue, 08 August 2006 22:57 Go to previous messageGo to next message
nvd077
Messages: 6
Registered: July 2006
Junior Member
Thank for your replication, but i can't get it done now.
Would you give me a sample?

Best regards
Re: Return structure from DLL to PL/SQL [message #186750 is a reply to message #186659] Wed, 09 August 2006 06:09 Go to previous message
wagnerch
Messages: 58
Registered: July 2006
Member
As I have mentioned, I have never done it with C. But the link I provided has several examples of calling a C function from PL/SQL. I have done it with Java in the database, which is similar from what I have seen.

It doesn't look overly complicated. Here is an Ask Tom link, where he outlines a basic C function from PL/SQL...

http://asktom.oracle.com/pls/ask/f?p=4950:8:4296854269409745244::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:934029542973
Previous Topic: SQL query rewrite, dimensions/datawarehouse with business objects
Next Topic: n00b View question!
Goto Forum:
  


Current Time: Wed Dec 07 06:46:52 CST 2016

Total time taken to generate the page: 0.08858 seconds