|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>Anyone have a very basic GUI ext example that was written with VC 5 or 6
>that they would like to share with me? I'm having trouble with POV
>loading my extension.
>
>I get the "Could not get Init address for GUI Extension DLL" error.
>And yes, I have __declspec(dllexport) in there.
>
>Thanks
>
>ryan
This was posted a few years ago without a follow-up answer that would have
saved me some time - so here is the answer now for anyone else needing it.
I had to modify the sample code for GUI extensions to get it to work when
compiled with VC++ 6.0 partly because the "__export" declaration is no
longer supported in 6.0, and because of the name decorations that the
compiler puts on functions.
When POV-Ray loads a GUI extension, it accesses the DLL and looks for a
function called "PovGuiExtensionGetPointers". In GuiDemo.c you will want to
modify the declaration of that function to look something like this:
__declspec(dllexport) DWORD __cdecl PovGuiExtensionGetPointers (int
RecSize, GuiPointerBlock *PointerBlock)
... 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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
|
|