Author Topic: Unable to create a screensaver  (Read 5585 times)

zmarian

  • Guest
Unable to create a screensaver
« on: August 30, 2006, 05:42:45 pm »
Hello,

I'm trying to build a minimal screensaver in Windows XP, see code at http://www.osix.net/modules/article/?id=538 . It builds and links with no errors with -Wall, but the window just doesn't open. Debugging doesn't help either -- the code is never reached as the spawned child probably doesn't call the required functions:

---------------
(gdb) break 1
Breakpoint 1 at 0x401290: file main.cpp, line 1.
(gdb) run
Starting program: something.exe
gdb: do_initial_child_stuff: process 2796
gdb: kernel event for pid=2796 tid=3592 code=CREATE_PROCESS_DEBUG_EVENT)
gdb: child_resume.SetThreadContext: thread 2796.0xe08
ContinueDebugEvent (cpid=2796, ctid=3592, DBG_CONTINUE);
gdb: kernel event for pid=2796 tid=3592 code=LOAD_DLL_DEBUG_EVENT)
gdb: child_resume.SetThreadContext: thread 2796.0xe08
ContinueDebugEvent (cpid=2796, ctid=3592, DBG_CONTINUE);
... LOAD_DLL_DEBUG_EVENT repeats ...
ContinueDebugEvent (cpid=2796, ctid=3592, DBG_CONTINUE);
gdb: kernel event for pid=2796 tid=3592 code=EXCEPTION_DEBUG_EVENT)
gdb: Target exception EXCEPTION_BREAKPOINT at 0x7c901230
gdb: child_resume.SetThreadContext: thread 2796.0xe08
ContinueDebugEvent (cpid=2796, ctid=3592, DBG_CONTINUE);
gdb: kernel event for pid=2796 tid=3592 code=EXIT_PROCESS_DEBUG_EVENT)

Program exited normally.
ContinueDebugEvent (cpid=2796, ctid=3592, DBG_CONTINUE);
gdb: child_close, inferior_ptid=3592
---------------

Debugging works for other Win32 applications in C::B.

I have no more ideas what to try, any help much appreciated.

zmarian

  • Guest
Re: Unable to create a screensaver
« Reply #1 on: August 30, 2006, 06:52:30 pm »
Could someone please try to build the sample code and report success/failure.
« Last Edit: August 30, 2006, 07:44:04 pm by zmarian »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Unable to create a screensaver
« Reply #2 on: August 30, 2006, 06:59:39 pm »
could someone please bring me a six-pack and icecream ... a small pizza weren't too bad too ...

zmarian

  • Guest
Re: Unable to create a screensaver
« Reply #3 on: August 30, 2006, 07:43:43 pm »
 8)

I meant someone who has the time etc -- currently this looks like a bug (in libscrnsave?) to me.

zmarian

  • Guest
Re: Unable to create a screensaver
« Reply #4 on: August 30, 2006, 08:15:24 pm »
It's working now. Either
  • using C linking (extern "C" {} around function implementations/using filename.c instead of filename.cpp)
  • renaming the application from app.exe -> app.scr
helped.

HTH others.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Unable to create a screensaver
« Reply #5 on: August 30, 2006, 09:08:25 pm »
I am surprised it works, as the closing brace to if(p_bmp == NULL){ is missing, so you should not be able to compile it at all...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

zmarian

  • Guest
Re: Unable to create a screensaver
« Reply #6 on: August 31, 2006, 10:22:24 am »
This was an obvious issue not worth mentioning.

The interesting point is whether it didn't work because C++ name mangling (of the callback names) or just because of the .exe/.scr extension problem.