delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/15/04:21:11

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
To: cygwin AT cygwin DOT com
X-Injected-Via-Gmane: http://gmane.org/
Path: not-for-mail
From: "Kristopher Buschelman" <kbuschelman AT attbi DOT com>
Newsgroups: gmane.os.cygwin
Subject: Using cygwin from win32 (MS VC) app
Date: Mon, 15 Apr 2002 01:11:29 -0700
Lines: 40
Message-ID: <a9e20v$m01$1@main.gmane.org>
NNTP-Posting-Host: 12-235-44-94.client.attbi.com
X-Trace: main.gmane.org 1018858336 22529 12.235.44.94 (15 Apr 2002 08:12:16 GMT)
X-Complaints-To: usenet AT main DOT gmane DOT org
NNTP-Posting-Date: Mon, 15 Apr 2002 08:12:16 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

I have a legacy application which is built with Microsoft Visual Studio and
I would like to take advantage of a few features of the cygwin API, namely
the file utilities for converting to/from POSIX paths.

It seems that the easiest manner for me to do this is to create a DLL with
gcc which contains wrappers of the cygwin calls I would like to make, as in:

::::::: begin file wrapper.c ::::::
#include <sys/cygwin.h>

void my_cygwin_conv_to_full_win32_path(const char *in,char *out) __attribute
((dllexport));

void my_cygwin_conv_to_full_win32_path(const char *in,char *out) {
  cygwin_conv_to_full_win32_path(in,out);
}

::::::: end file wrapper.c ::::::
> gcc -shared wrapper.c -o wrapper.dll
> gcc --version
2.95.3-5

Then, from the MS-VisualStudio c language code, I make DYNAMIC calls to the
wrapper routine via GetProcAddress....  It works fine, but making the
wrapper is a bit less than desirable, not because of the dynamic call --
which I want anyway.

When I try to make the dynamic call directly to cygwin1.dll (cygwin
1.3.10-1), I get a memory access violation -- memory could not be read.

My question is, is there something "obvious" I have missed?  Why can I not
do this directly on cygwin1.dll?  What happens behind the scenes to make the
wrapper approach work, while the direct dynamic call fails?  Will there be a
cygwinapi.dll (pick your favorite name) which can be linked to dynamically
without additional setup like my wrapper dll?

Thanks for the help.
    Kristopher





--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019