I am able to open a file and write into it from a console application, but the same fails when done from within a function that is stored in a DLL and called from a Visual Basic application.
This is the console app: ,---- | #include <fcntl.h> | | int main (int argc, char * argv[]) { | int fd; | char *msg = "Hello, world\n"; | | fd = open ("file.txt", O_CREAT | O_RDWR); | if (fd == -1) { | perror ("open()"); | exit (-1); | } | | write (fd, msg, strlen (msg)); | } `---- And this is the source of foo.dll: ,---- | #include <fcntl.h> | | int WINAPI DllMain (HINSTANCE H, DWORD d, PVOID p) { | return TRUE; | } | | int OpenSomething () { | int fd; | | char *msg = "Hello, world\n"; | | fd = open ("file.txt", O_CREAT | O_RDWR); | if (fd == -1) { | perror ("open()"); | exit (-1); | } | | write (fd, msg, strlen (msg)); | return TRUE; | } `---- The DLL is compiled with (found in the archives): $(LD) --dll --subsystem windows -e [EMAIL PROTECTED] -o jnk --base-file foo.base \ foo.o -L $(LIB)/w32api -luser32 -c $(DLLTOOL) --dllname foo.dll --base-file foo.base --def foo.def --output-lib \ foo.a --output-exp foo.exp $(LD) --dll --subsystem windows -e [EMAIL PROTECTED] -o foo.dll foo.o -L \ $(LIB)/w32api -luser32 -c foo.exp rm jnk foo.base foo.exp When run under Wine, the VB app hangs on the open() and causes this: err:ntdll:RtlpWaitForCriticalSection section 0x610d1ef8 "?" wait timed out, retrying (60 sec) tid=080771f8 When run on a w98 box, it crashes on the open() with an ``Invalid Page Fault'' (sort of, I'm translating from Italian). The console application works just fine both on the box and under Wine. What am I missing? -- 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/