delorie.com/archives/browse.cgi | search |
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 |
Message-ID: | <20030402011336.8866.qmail@web21401.mail.yahoo.com> |
Date: | Wed, 2 Apr 2003 11:13:36 +1000 (EST) |
From: | =?iso-8859-1?q?Danny=20Smith?= <danny_r_smith_2001 AT yahoo DOT co DOT nz> |
Subject: | Re: Can open() from console app, not from dll |
To: | Massimiliano Mirra <mmirra AT libero DOT it> |
Cc: | cygwin AT cygwin DOT com |
In-Reply-To: | <87d6k5n57f.fsf@prism.localnet> |
MIME-Version: | 1.0 |
--- Massimiliano Mirra <mmirra AT libero DOT it> wrote: > Danny Smith <danny_r_smith_2001 AT yahoo DOT co DOT nz> writes: > > >> I am able to open a file and write into it from a console application, > >> but the same fails when done from within a function that is stored in > >> a DLL and called from a Visual Basic application. > > > > VB expects stdcall convention. > > Try adding WINAPI to OpenSomething > > Hmmm. If I understand correctly, and it's to be written ``int WINAPI > OpenSomething'', it seems that it becomes unable to even call the > function: > > ``Can't find DLL entry point OpenSomething in foo.dll'' In this specific case, the __stdcall isn't really necessary, since your are passing parameters. In general however, VB expects the callee to cleanup the stack. I added the __stdcall qualifier OpenSomething and built dll like so: gcc --shared -ofoo.dll -Wl,--add-stdcall-alias foo.c This will export OpenSomething AT 0 as well as the alias OpenSomething I put the dll where Excel could find it and added this to a module in a worksheet: Declare Function OpenSomething Lib "foo.dll" () As Integer and when I called OpenSomething from the worksheet it opened the file and wrote to it. No problem Ditto if I build with -mno-cygwin. However, if your VB app is calling MS runtime IO functions to do other things you may have cygwin1.dll vs MS runtime conflicts. Have you tried with -mno-cygwin? Danny http://mobile.yahoo.com.au - Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile. -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |