Message: 4211476 : JTC x DLL

"w w" <[email protected]> Tue, 08 Apr 2003 17:19:56 -0300
Newsgroups gmane.comp.lib.jtc
Message-ID <[email protected]>
<html><div style=3D'background-color:'><DIV>Hi,</DIV>
<DIV>I`m with equal problem: The program crashes after an access violatio=
n.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Do you can help me, sending... complete&nbsp;example ?</DIV>
<DIV>Best regards,</DIV>
<DIV>&nbsp;</DIV>
<DIV>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D</DIV>
<DIV>Hi,</DIV>
<DIV>On Fri, Aug 18, 2000 at 01:50:57PM +0200, Philipp Stadler wrote:<BR>=
&gt; Hi,<BR>&gt; I`m currently writing a small example ( microsoft vc 6.0=
 under windows NT )<BR>&gt; using dll in combination with the JTC classes=
 and facing a&nbsp; problem: The<BR>&gt; program crashes after an access =
violation. I`ll outline my test suit:<BR>&gt;<BR>&gt; #include &lt;JTC/JT=
C.h&gt;<BR>&gt; #define DllExport __declspec( dllexport )<BR>&gt;<BR>&gt;=
 class PH_Thread :<BR>&gt;&nbsp;&nbsp;&nbsp; public JTCThread<BR>&gt; {<B=
R>&gt;&nbsp;&nbsp;&nbsp; public:<BR>&gt;&nbsp;&nbsp;&nbsp; DllExport PH_T=
hread();<BR>&gt;&nbsp;&nbsp;&nbsp; virtual DllExport ~PH_Thread();<BR>&gt=
;&nbsp;&nbsp;&nbsp; virtual void DllExport run();<BR>&gt; };</DIV>
<DIV>If you do not want to have DllExport defined as __declspec(dllexport=
)<BR>when you build your application, you should only define it when you =
are<BR>building your DLL.</DIV>
<DIV>&gt;<BR>&gt; This is the class which I want to include in the dll. I=
n my application I`m<BR>&gt; using it in the following way:<BR>&gt;<BR>&g=
t; int main( int argv, char** argc )<BR>&gt; {<BR>&gt;&nbsp;&nbsp;&nbsp; =
try<BR>&gt;&nbsp;&nbsp;&nbsp; {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JTC=
Initialize bootJTC( argv, argc );<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; J=
TCHandleT&lt; MonitorThread &gt; monThr =3D new MonitorThread;<BR>&gt;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; monThr -&gt; start();<BR>&gt;&nbsp;&nbsp;&nbs=
p; }<BR>&gt;&nbsp;&nbsp;&nbsp; catch ( const JTCException &amp; e )<BR>&g=
t;&nbsp;&nbsp;&nbsp; {<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt=
; "Exception: " &lt;&lt; e.getMessage() &lt;&lt; endl;<BR>&gt;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<BR>&gt;&nbsp;&nbsp;&nbsp; }<BR>&=
gt;&nbsp;&nbsp;&nbsp; return EXIT_SUCCESS;<BR>&gt; }<BR>&gt;<BR>&gt; This=
 program crashed in the routine JTCThread::init( .... ) and I think the<B=
R>&gt; reason is that the instruction<BR>&gt!
;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; JTCThreadGroupHandle group_ =3D current=
Thread() -&gt; getThreadGroup();<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; // Line =
556 of Thread.cpp<BR>&gt;<BR>&gt; returns 0 for the object of the handled=
 object. So it crashes a few lines<BR>&gt; later at<BR>&gt;<BR>&gt;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; group_ -&gt; add(this);<BR>&gt; because of an ac=
cess violation group_.tg_ is still 0!!!<BR>&gt;<BR>&gt; Is it possibel to=
 make a dll, like I tried to, at all?<BR>&gt; Have I forgotten something?=
<BR>&gt; Where`s the bug?<BR>&gt;<BR>&gt; Thanks for your help in advance=
 Philipp</DIV>
<DIV>I tried a small example similar to what you have done here and there=
<BR>does not appear to be a problem.&nbsp; Which compiler flags did you u=
se to<BR>build your application?&nbsp; Were they the same as the ones you=
 use to build<BR>the JThreads/C++ library?&nbsp; If they were not, then y=
ou could run into<BR>problems.&nbsp; Please take a look at jtc/README.WIN=
DOWS for details.</DIV>
<DIV>Best regards,</DIV>
<DIV>Brent</DIV>
<DIV>--</DIV></div><br clear=3Dall><hr>MSN Messenger: converse com os seu=
s amigos online.  <a href=3D"http://g.msn.com/8HMUBRBR/2749">IInstale gr=E1=
tis. Clique aqui. </a> Get 2 months FREE*. </html>
_______________________________________________
JTC-Users Mailing List - [email protected]
http://www.orbacus.com/mailman/listinfo/jtc-users
Visit our support FAQ before you send a message.
http://www.orbacus.com/faq/support.html