This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE : Call dynamic pointer

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.


Lucien Mathieu wrote:

Hello again,

following this example:


		class Tobject {

		extern "C" {
			void * init();


		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
	dlopen, dlsym, dlcose... It's generating a segmentation fault,
	it due to the load and unload of the DLL? Even if I don't call
	dlclose at the end, it's still doing the segmentation fault, is
	a way of passing the pointer from the DLL to the main program
	dlopen/dlsym stuff?

Let me know if I can't ask this kind of question to the list ;-P

Thanks in advance,

-----Message d'origine-----
De : Ronald Landheer-Cieslak [] Envoyé : lundi 21 juillet 2003 15:48
À : Lucien Mathieu
Cc :
Objet : Re: Call dynamic pointer

On Mon, 21 Jul 2003, Lucien Mathieu wrote:


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 for more information.



Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]