X-Spam-Check-By: sourceware.org Message-ID: <89c3ea2b0612202020j56ab0f26id7c2d06a2ee640b1@mail.gmail.com> Date: Wed, 20 Dec 2006 23:20:28 -0500 From: "andy wang" To: cygwin AT cygwin DOT com Subject: Re: how to compile the .so to allow extern functions In-Reply-To: <89c3ea2b0612161003t495bc89dk9473d13d00c9220e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <89c3ea2b0612152114u5150ecfara058c41a00a70dac AT mail DOT gmail DOT com> <45838A0F DOT 82A8B52B AT dessent DOT net> <89c3ea2b0612160805w5d83e536o510f2f0a1317e77d AT mail DOT gmail DOT com> <89c3ea2b0612161003t495bc89dk9473d13d00c9220e AT mail DOT gmail DOT com> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 Hi, All: > > $ gcc -shared -o bug1-main.so bug1-main.c -ldl -Wl,--out-implib=libmain.dll.a > Creating library file: libmain.dll.a > $ gcc -shared -o bug1.so bug1.c -L. -lmain > $ gcc -o bug1-main bug1-main.c -ldl > $ ./bug1-main.exe > in myfunc.so > in main.func1() > This method is wrong, because the bug1.so still depends on bug1-main.so, so if I delete the bug1-main.so it will do nothing! The correct method should be: bug1-main.c ==> __declspec(dllexport) int func1() gcc -c bug1-main.c dlltool.exe --export-all --output-def bug1-main.def bug1-main.o gcc -o bug1-main bug1-main.c -ldl dlltool.exe --dllname bug1-main.exe --def bug1-main.def --output-lib libbug1-main.dll.a gcc -shared -o bug1.so bug1.c -L. -lbug1-main // or gcc -shared -o bug1.so bug1.c libbug1-main.dll.a Reference: http://mail.python.org/pipermail/python-list/2002-May/143575.html My question is why the --export-dynamic doesn't work ? gcc -Wl,--export-dynamic -o bug1-main bug1-main.c -ldl Regards, Andy -- 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/