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 Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 20 Jan 2002 12:01:46 -0600 From: Tim Subject: Re: DLL And Visual Basic To: cygwin AT cygwin DOT com Message-id: <007401c1a1dc$86c1a800$fa34fea9@rineco.com> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Mailer: Microsoft Outlook Express 5.50.4522.1200 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7bit X-Priority: 3 X-MSMail-priority: Normal Ok, I've gotten a little further in my endeavors and am stumped again. Actually this is pretty much where I was stumped in the beginning, but I have made some moderate headway. I have successfully created a dl that can be called (successfully mind you) from Visual Basic, but unfortunately only once. ;-) Any attempt to run the app again without first shutting it down will result in the following: VB6 caused an invalid page fault in module CYGWIN1.DLL at 0177:610066e2. Registers: EAX=00000000 CS=0177 EIP=610066e2 EFLGS=00010202 EBX=00000000 SS=017f ESP=045ffc08 EBP=045ffc20 ECX=63c40000 DS=017f ESI=610a47c0 FS=7797 EDX=00000001 ES=017f EDI=00000000 GS=0000 Bytes at CS:EIP: 8b 43 2c 85 c0 7f 1b 68 80 66 00 61 68 b4 66 00 Stack dump: 00000001 63c40000 00000000 7ff420db 7ff20000 00000002 045ffc40 61006bf7 610a47c0 00000000 00000000 00000000 00000000 00000000 045ffc70 63c410ba What it is that I have or have not done to prevent this, is beyond me, but perhaps someone could point me in the right direction. ;-) I found some examples here and there and put together the following: --- MyTest.c -- #include int WINAPI testit (int i) { return(i+1); } -- MyTest.def -- EXPORTS testit=testit AT 4 -- MyMakeTestDLL.sh -- #!/bin/sh gcc -nostartfiles -c -DBUILD_DLL MyTest.c dllwrap --def=MyTest.def --output-lib=libtstdll.a --dllname=MyTest.dll --dri ver-name=gcc MyTest.o I then copied MyTest.dll \windows\system Added the following to VB: Private Declare Function doit Lib "bar.dll" (ByVal myNumber As Long) As Long Private Sub Form_Load() Dim i As Long i = doit(100) End Sub Calling doit returns 101.....so far so good. Now I run it again w/out closing down the app and *POOF* ,VB tanks!!! What am I missing here? Am I doing something wrong, or is this what I'm in for? I also had to copy /usr/bin/cygwin1.dll to \windows\system in order to even attempt to use the newly created DLL. I thought I read something somewhere where you could created a DLL that wouldn't require this, but then again I could be wrong b/c I can't find it now. Anyhow, I suppose that's not as important to me right now as much as figuring out why it's crashing VB after I run it twice. Any and all help/comments/flames/suggestions always welcome. Best Regards, -tim --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 12/12/01 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/