POV-Ray : Newsgroups : povray.programming : re: VC++ 6.0 & GUIext : Re: VC++ 6.0 & GUIext Server Time
28 Jul 2024 10:28:07 EDT (-0400)
  Re: VC++ 6.0 & GUIext  
From: John Pallett
Date: 31 May 2002 14:58:44
Message: <3cf7c7e4$1@news.povray.org>
Yes - and after experimenting, I discovered that using a __cdecl was
actually VERY wrong.  Using a __cdecl will work for the Debug version of
POV-Ray, but not the Release version, because in fact you should keep it a
WINAPI (which defaults to __stdcall).  This is becasue functions declared as
__cdecl handle their own stack popping, whereas functions declared with
__stdcall do not, and the caller handles it.  Setting the function as a
__cdecl when POV-Ray thought it was a __stdcall caused the stack to be
popped twice!  Why in Release and not in Debug - I don't know.

At any rate - simply adding the following lines to the .DEF file:

---

EXPORTS
 PovGuiExtensionGetPointers

---

And keeping the function as:

---

DWORD WINAPI PovGuiExtensionGetPointers (int RecSize, GuiPointerBlock
*PointerBlock)

---

Now works for me, for both versions.

Side note: I removed the __export directive, but this is OK because the .DEF
file explicitly exports the function.

Sorry for giving misleading information before.

JP



"Scott Moore" <sdm### [at] zoomcouk> wrote in message
news:bpgefusppt0lrh5n89f262nngrjpl0h5nj@4ax.com...
> On Thu, 30 May 2002 17:04:08 -0700, "John Pallett"
> <joh### [at] chiefarchitectcom> wrote:
>
> <snip>
> >
> >... using WINAPI like the original GuiDemo.c unfortunately can cause the
> >name to be decorated in the linker, meaning that when POV-Ray looks for
> >PovGuiExtensionGetPointers it cannot find it, because the name gets
munged
> >to _PovGuiExtensionGetPointers@8 or something similar.  There are other
ways
> >of accomplishing the same result but this worked for me.
> >
> >JP
> >
>
> Yes, decorated ( including C++ mangled ) names can be a pain when
> trying to get function addresses using GetProcAddress. However, if you
> include a .def file in your project and ensure you have
> PovGuiExtensionGetPointers listed in the EXPORTS section you will not
> need to worry about decorated names.
>
> Scott
>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.