Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

COM Apartments and threading

843829Jan 7 2003 — edited Feb 8 2003
I have a COM component in a DLL. I instantiate and use the COM Component within an ordinary DLL via native methods. Now i use CoInitialize and CoCreate in the process attach.

Now the Java class that has the native methods was originally single threaded and everything worked fine. I then implemented Runnable and moved the calling code to the run() and then the VM began to crash. I felt that the object was getting destroyed incorrectly.

I was able to solve the problem by not actually doing loadLibrary in a static block but in a separate method which i explicitly called in the run() before making the rest of the calls. Now it appears the coinitialize and Cocreate are happening in the correct thread context and there is no problem.

I would like to know if there is any serious problem in making multiple calls to loadLibrary( ).

thanks in advance
- shyamal
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2003
Added on Jan 7 2003
3 comments
238 views