This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using cygwin from win32 (MS VC) app


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]