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

dllhelpers-0.2.5/c++ doesn't work


Without touching the source, compiling the c++ example leads to warnings
about not being able to find __cygwin_dll_entry@12. When executed, the
binary puts a message box saying
"The dynamic link library cxxdll.dll is not written correctly. The stack
pointer has been left in an inconsistent state. The entrypoint should be
declared as WINAPI or STDCALL" 
Effectively the program cannot run.

Adding the following to dllclass.cc to try to address the above problem:

extern "C" {

#include <windows.h>

  int WINAPI
  _cygwin_dll_entry(HANDLE h, DWORD reason, void *foo)
  {
    return 1;
  }
}

solves the build warnings. When run, the program produces the following
output:
Global integer variable = 5
DllClass 1 (Imported from DLL):
  virtual_method = 0
  non_virtual_method = 0
  instances = 0
DllClass 2 (Imported from DLL):
  virtual_method = 0
  non_virtual_method = 0
  instances = 0
DllClass (Local):
  virtual_method = 27
  non_virtual_method = 9
  instances = 1

The README file shows different output. The above is clearly the result
of a bug. In particular, with the latest cygwin net release, I am unable
to get constructors run on global objects. I'm guessing this is why
using iostreams in a dll leads to a crash.
Does anyone have a solution? Suggestions? 
Or perhaps the necessary build commands changed?

Nigel

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