delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/21/15:42:35

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Info: This message was accepted for relay by
smtp03.mrf.mail.rcn.net as the sender used SMTP authentication
X-Trace: UmFuZG9tSVZ1qVp1UUUpQXqmwX/SsQAAffZDI6bwByk9/zjzQuJhs9YZC3MZhcOd
Message-ID: <3F1C413A.2040204@cygwin.com>
Date: Mon, 21 Jul 2003 15:38:34 -0400
From: Larry Hall <cygwin-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Lucien Mathieu <lucien DOT mathieu AT skynet DOT be>
CC: "'Ronald Landheer-Cieslak'" <ronald AT landheer DOT com>, cygwin AT cygwin DOT com
Subject: Re: RE : Call dynamic pointer
References: <000501c34fbe$5a5200d0$837588d9 AT arthas>
In-Reply-To: <000501c34fbe$5a5200d0$837588d9@arthas>

Sorry, this still isn't enough to see exactly what you're doing and
where the problem is.  If you can't make a simple case that can be
sent to the list so others can easily build and try your code to
reproduce the problem, then you're unlikely to see much help coming
from anyone on this list.  Also, as I mentioned in my previous response,
this really isn't a general C/C++ inquiry list.  It's a list to discuss
Cygwin.  If you find that your problem is relative to Cygwin's
implementation of dlopen and friends, this is the proper list to report/
discuss that.  If the problem is caused by some obscure compiler bug that
is specific to Cygwin, this is the right list.  If you're just not sure
how to get code like this working or you have some other non-Cygwin
specific issue, then a different forum is more appropriate.

Larry

Lucien Mathieu wrote:

> 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019