Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining if Pro*C/C++ threads enabled

Status
Not open for further replies.

countrypaul

Technical User
Apr 29, 2004
48
0
0
GB
I have a situation where an application could load one or both of two DLLs dynamically. Both DLLS are multithreaded and written in Pro*C/C++. The application itself is not linked to Oracle and cannot be.

In order for the DLL's to work the Pro*C/C++ must include
EXEC SQL ENABLE THREADS

before any other EXEC SQL comands. Further Oracle require that this is only done once or an erro will occur.

Is there a way to determine if EXEC SQL ENABLE THREADS has alrady been executed ?

TIA

Paul
 
Paul,

From what I've seen, your application needs but a single reference of this statement, similar to a variable declaration or global directive; you shouldn't in other words put it in a bunch of different places within your applicaltion allowing for the possibility of multiple calls. It is a directive that simply allows for the possibility of multi-threaded applications to behave as multi-threaded applications. Unfortunately, because it is simply a permission of sorts, your best bet is to use test conditions that specifically call each thread. Further, it may be worthwhile to create a text file to which an entry is appended when each thread starts. Oracle in and of itself is interoperable with programming languages, but your actual interface is largely transparent. In my opinion, your best bet is to validate functionality in test, as Oracle itself won't provide any feedback for the "permission" that is requested.

If you feel that I haven't captured the nature of your issue, please give a bit more infoprmation about your application such that I have a bit more clarity as to your end.

Regards,
Tim
 
Tim,

I am not too clear on whether you have fully understood the limitations of the fact I need to effectively share a declaration between two DLLs without the main application managing the process. The Oracle declaration does a little more than set a permission as it also sets up the libraries to use within Oracle.

The solution I am adopting is to use a shared data_seg between the DLLs which allows a variable to be initialised once but is then available to all code that references the data_seg. This appears to be the M$ recommended way of sharing variables between DLLs in the same process space.

It appears much tidier than writing external files which was, as you suggested, another approach.

Paul

 
Paul -

Best of luck! Without seeing your code, and based on your first posting, I thought that your main application was managing the process. Based on your response, absolutely, the way that you're approaching it is probably the best solution.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top