public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: DLL's for use with other languages...
@ 1997-06-16  7:57 marcus
  0 siblings, 0 replies; 5+ messages in thread
From: marcus @ 1997-06-16  7:57 UTC (permalink / raw)
  To: GNU-WIN32; +Cc: HARBAUGH

>   >From:	SMTP%"jrussell@voicenet.com" 12-JUN-1997 13:33:54.79
>   > What I want to know is
>   >can GNU-WIN32 or cygwin32 create dll's that can be used by Visual Basic?
>   >I have tried some small dll's and tested with C drivers which works ok,
>   >but when I try to use with VisBasic I get one of several errors..
>   >
>   >   unable to find function in dll
>   >   invalid call (help makes ref to pascal calling convention)
>   >
>   >I have tried using cygwin32, mingw32, and also lcc.. all pass the C
>   >driver test, but all fail the VB test
>   >
>   >any help would be appreciated..
> 
> I wish I could be of help, but unfortunately I have not been able to solve this
> problem either.  I too want to use cygwin32 dll's with Visual Basic, and end up
> with the same error.  I have tried using both relocatable and non-relocatable
> dll's.  I went to Microsoft's website and tried all their suggestions about
> using '__stdcall' and 'declspec(dllexport)' to no avail.
> 
> I would really like to understand why this is happening, but I don't know enough
> about the internal's of DLL structure to fix the problem.
> 
> It would really be great if someone who had solved the problem of using cygwin32
> dll's with OTHER programs (especially Visual Basic) would provide an example.

I have been attempting to get cygwin32 to interoperate with MS VC++ with only
limited success.  I have been doing this in my spare time only.  I have been
modifying dlltool to produce dlls in the same format as MS tools and have
gotten fairly close.   There are a couple of relocation types that are used
differently between cygwin32 and MS, and MS seems to depend on the file
names within the archive to be the same instead of dt.o, dh.o, dX.o, etc.
used by dlltool.  It appears that MS and gnu differ on what constitutes an
individual module within an archive.

I will hopefully have some time pretty soon to update my changes to the b18
version of cygwin32 and continue my investigation.  In the mean time, if
anyone would like to pick up the changes as they are, I can send diffs
for b17.1...

marcus hall
Lucent Technologies
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: DLL's for use with other languages...
  1997-06-12 20:28 HARBAUGH
@ 1997-06-16  8:36 ` David Essex
  0 siblings, 0 replies; 5+ messages in thread
From: David Essex @ 1997-06-16  8:36 UTC (permalink / raw)
  To: gnu-win32; +Cc: Toni Harbaugh-Blackford, J Russell Smyth

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

J Russell Smyth wrote:
> ....
>What I want to know is can GNU-WIN32 or cygwin32 create DLL\x12s that can be
used 
>by Visual Basic?

Toni Harbaugh-Blackford you wrote:
> .....
>I too want to use cygwin32 DLL\x12s with Visual Basic, and end up
>with the same error.  I have tried using both relocatable and non-relocatable
>It would really be great if someone who had solved the problem of using
cygwin32
>DLL\x12s with OTHER programs (especially Visual Basic) would provide an example.

I have a working example of a DLL which is compiled under gnu-win32 gcc and
works when it is called from Delphi2 and from another gnu-win32 C program.
It is auto loaded at run time, and is compiled using b18 under Win95. See
enclosed attached source code.


The strange thing about this working example is that it requires 2
different type of declarations. For example the following code will work;

/* gnu-win32 C program declaration */
extern int foo1(...); 
extern char* foo2(...);

/*  DLL C program function */
int foo1(...) { ... }
char* foo2(...) { ... }
int WINAPI dllEntry(HANDLE hDll, DWORD reason, LPVOID reserved)
{   return 1; }

/* Delphi2 Pascal program declaration */
function foo1(t: integer): Integer; stdcall;
function foo2(t: integer): Pchar; stdcall;

However similar code(i.e.: STDCALL IWNAPI) in the C as in the Delphi
calling program will compile but will not load.

/* gnu-win32 C program declaration */
extern int WINAPI foo1(...); 
or
extern char* STDCALL foo2(...);

Any way it works. Hope this helps,

David

[-- Attachment #2: sample.tgz --]
[-- Type: application/x-gzip, Size: 2507 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: DLL's for use with other languages...
@ 1997-06-12 20:28 HARBAUGH
  1997-06-16  8:36 ` David Essex
  0 siblings, 1 reply; 5+ messages in thread
From: HARBAUGH @ 1997-06-12 20:28 UTC (permalink / raw)
  To: GNU-WIN32; +Cc: HARBAUGH

  >From:	SMTP%"jrussell@voicenet.com" 12-JUN-1997 13:33:54.79
  >To:	HARBAUGH
  >CC:	
  >Subj:	DLL's for use with other languages..
  >
  >
  >Hello all..
  >
  >  I am new to GNU-WIN32 and to windows C/C++ programming in general,
  >though fairly competent C programmer in DOS/UNIX. What I want to know is
  >can GNU-WIN32 or cygwin32 create dll's that can be used by Visual Basic?
  >I have tried some small dll's and tested with C drivers which works ok,
  >but when I try to use with VisBasic I get one of several errors..
  >
  >   unable to find function in dll
  >   invalid call (help makes ref to pascal calling convention)
  >
  >I have tried using cygwin32, mingw32, and also lcc.. all pass the C
  >driver test, but all fail the VB test
  >
  >any help would be appreciated..

I wish I could be of help, but unfortunately I have not been able to solve this
problem either.  I too want to use cygwin32 dll's with Visual Basic, and end up
with the same error.  I have tried using both relocatable and non-relocatable
dll's.  I went to Microsoft's website and tried all their suggestions about
using '__stdcall' and 'declspec(dllexport)' to no avail.

I would really like to understand why this is happening, but I don't know enough
about the internal's of DLL structure to fix the problem.

It would really be great if someone who had solved the problem of using cygwin32
dll's with OTHER programs (especially Visual Basic) would provide an example.

  >
  >   Russ Smyth
  >   jrussell@voicenet.com
  >-
  >For help on using this list (especially unsubscribing), send a message to
  >"gnu-win32-request@cygnus.com" with one line of text: "help".
------------------------------------------------------------------------------
| Toni Harbaugh-Blackford           | Internet: harbaugh@ncifcrf.gov         |
| System Manager                    |                                        |
| Biomedical Supercomputing Center  | Phone:  (301) 846-5798                 |
| SAIC                              | FAX:    (301) 846-5762                 |
| NCI-FCRDC                         |                                        |
| PO Box B, Bldg 430                |                                        |
| Frederick, MD 21702-1201   USA    |                                        |
------------------------------------------------------------------------------
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DLL's for use with other languages..
  1997-06-11 22:16 J Russell Smyth
@ 1997-06-12  6:38 ` Gunther Ebert
  0 siblings, 0 replies; 5+ messages in thread
From: Gunther Ebert @ 1997-06-12  6:38 UTC (permalink / raw)
  To: J Russell Smyth; +Cc: gnu-win32

Hi,

the problem might be that you haven't declared your dll functions
as _stdcall (using the WINAPI or STDCALL macro).

If the prototypes of your dll functions look like

int foo();

they have to be changed to

int WINAPI foo();

Note that you have to #include <windows.h> to use 
the WINAPI macro.

Hope this helps,
Gunther


J Russell Smyth wrote:
> 
> Hello all..
> 
>   I am new to GNU-WIN32 and to windows C/C++ programming in general,
> though fairly competent C programmer in DOS/UNIX. What I want to know is
> can GNU-WIN32 or cygwin32 create dll's that can be used by Visual Basic?
> I have tried some small dll's and tested with C drivers which works ok,
> but when I try to use with VisBasic I get one of several errors..
> 
>    unable to find function in dll
>    invalid call (help makes ref to pascal calling convention)
> 
> I have tried using cygwin32, mingw32, and also lcc.. all pass the C
> driver test, but all fail the VB test
> 
> any help would be appreciated..
> 
>    Russ Smyth
>    jrussell@voicenet.com
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".

-- 

Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig

Phone : +49 341 48503-0
Fax   : +49 341 48503-99
E-mail: mailto:gunther.ebert@ixos-leipzig.de
www   : http://www.ixos-leipzig.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* DLL's for use with other languages..
@ 1997-06-11 22:16 J Russell Smyth
  1997-06-12  6:38 ` Gunther Ebert
  0 siblings, 1 reply; 5+ messages in thread
From: J Russell Smyth @ 1997-06-11 22:16 UTC (permalink / raw)
  To: gnu-win32

Hello all..

  I am new to GNU-WIN32 and to windows C/C++ programming in general,
though fairly competent C programmer in DOS/UNIX. What I want to know is
can GNU-WIN32 or cygwin32 create dll's that can be used by Visual Basic?
I have tried some small dll's and tested with C drivers which works ok,
but when I try to use with VisBasic I get one of several errors..

   unable to find function in dll
   invalid call (help makes ref to pascal calling convention)

I have tried using cygwin32, mingw32, and also lcc.. all pass the C
driver test, but all fail the VB test

any help would be appreciated..

   Russ Smyth
   jrussell@voicenet.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-06-16  8:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-16  7:57 DLL's for use with other languages marcus
  -- strict thread matches above, loose matches on Subject: below --
1997-06-12 20:28 HARBAUGH
1997-06-16  8:36 ` David Essex
1997-06-11 22:16 J Russell Smyth
1997-06-12  6:38 ` Gunther Ebert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).