Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Lucien Mathieu" To: "'Ronald Landheer-Cieslak'" Cc: Subject: RE : Call dynamic pointer Date: Mon, 21 Jul 2003 21:29:02 +0200 Message-ID: <000501c34fbe$5a5200d0$837588d9@arthas> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h6LJRKn00310 Hello again, following this example: TObject.hpp: class Tobject { ... }; extern "C" { void * init(); } TObject.cpp void * init() { return (new Tobject()); } I create a DLL, g++ -c Tobject.cpp g++ -shared -o Tobject.dll Tobject.o When calling the init function after initialising everything with dlopen, dlsym, dlcose... It's generating a segmentation fault, is it due to the load and unload of the DLL? Even if I don't call the dlclose at the end, it's still doing the segmentation fault, is there a way of passing the pointer from the DLL to the main program using dlopen/dlsym stuff? Let me know if I can't ask this kind of question to the list ;-P Thanks in advance, Lucien. -----Message d'origine----- De : Ronald Landheer-Cieslak [mailto:ronald AT landheer DOT com] Envoyé : lundi 21 juillet 2003 15:48 À : Lucien Mathieu Cc : cygwin AT cygwin DOT com Objet : Re: Call dynamic pointer On Mon, 21 Jul 2003, Lucien Mathieu wrote: > Hello, > > in a dll, I'm calling a > > extern "C" { > void * init(); > } > > where it is define as follow > > void * init() { > return (new TObject()); > } > > it's doing a segment fault, > does the new pointer is automatically deleted? > > I was thinking not to use the dlclose in the main program, > but it doesn't work either. > > Any idea how to return a pointer from a DLL to a main program? > > Thanks in advance, You're not providing nearly enough information about your problem. Have a look at http://www.cygwin.com/problems.html for more information. HTH rlc -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/