This is the mail archive of the cygwin@sourceware.cygnus.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]

Re: cygwin DLLs and VC


Incubus "Inc gnita" <icg_incubus@yahoo.com> writes:
>   I've tried compiling a working VC++ DLL project
> using the dllhelpers r2.4 provided with Cygwin B20,
> and found out that despite the result worked fine
> with Gygwin's GCC compiled exes, it didn't work at
> all with the same exes compiled with VC. 
>   In fact, it returns exactly the same adress for
> the dll imported function in both cases, but when
> calling it from VC it causes a GP fault. The exports
> are done using old-fashion .DEF style, so I'm
> forcing the calling convention to "C" using the extern
> "C" directive, that I think that should be supported
> by
> both compilers.
>   If any of you found this problem or have any idea
> about solving it, please let me know.

Let me see if I understand this.

1. VC++ compiled DLL loaded dynamically from VC++ compiled main app.
   - Works.
2. Cygwin compiled DLL loaded dynamically from VC++ compiled main app.
   - Does not work.

If this is the case, then it's expected. Cygwin v1.1 will have full
functionality to be loaded dynamically by non-cygwin application, but
b20.1 has only partial support.

To make it work with b20.1, and keeping in mind that you'll only have
partial support, use __cygwin_noncygwin_entry@12 as the entry point 
for your Cygwin DLL.

See my examples for Java JNI or Excel DLL etc on:
  http://www.xraylith.wisc.edu/~khan/software/gnu-win32/

Good news is that all this hackery will go away, at least in theory, 
in the upcoming Cygwin v1.1.

BTW, you may need to make loadable functions, such as Register, use
the __stdcall calling convention, or else you may run into stack
corruption. 

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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