[coding] External Symbols

Hi there people,

i was experimenting a bit with the sdk.

i have the following code:

std::string MsgStr;
     PixelBufferInterface *pixelBuffer=static_cast<PixelBufferInterface*>(GET_INTERFACE(vrayVFB, EXT_PIXEL_BUFFER_INTERFACE));

if (pixelBuffer) {
        int width=pixelBuffer->getWidth();
        int height=pixelBuffer->getHeight();
        //printf(“Image size is %i x %i\n”, width, height);
        MsgStr += “Image width is :”;
        MsgStr += width;

//CString cs(MsgStr.c_str());
        MessageBox(NULL,MsgStr.c_str(),“Warning”,MB_OK);
    }

it all compiles fine, but when i try to build the project i get an error:
error LNK2019: unresolved external symbol “class ClassDesc2 * __cdecl GetInterfaceToolDesc(void)” (?GetInterfaceToolDesc@@YAPAVClassDesc2@@XZ) referenced in function “class ClassDesc * __cdecl LibClassDesc(int)” (?LibClassDesc@@YAPAVClassDesc@@H@Z)

the only thing i change in this code (what was taken from the help file) was :EXT_PIXEL_BUFFER_INTERFACE
the helpfile it says without EXT_ and that i not working.
Perhaps you c++ guru’s know why i get this error ?
i added a couple of lib files to my project but that does not seem to solve it.

ps: there is a little typo error in the help by getting the width :slight_smile:

Just copy and paste the InterfaceID for EXT_PIXEL_BUFFER_INTERFACE and it should be fine. For some weird reason it is not a #define like other extensions.

Best regards,
Vlado

hmm was something else,
i put a part of code in the vutils namespace, corrected this and it seems to work. even with EXT_PIXEL_BUFFER_INTERFACE

Ah, good.

Best regards,
Vlado

i’m still trying to connect to the VFB,

i use the following function:

std::string MsgStr;
    //#define EXT_PIXEL_BUFFER_INTERFACE InterfaceID(LARGE_CONST(2005120901))
    //EXT EXT_PIXEL_BUFFER_INTERFACE
    VUtils::PixelBufferInterface *pixelBuffer=static_castVUtils::PixelBufferInterface\*(GET_INTERFACE(vrayVFB,EXT_PIXEL_BUFFER_INTERFACE));

if (pixelBuffer) {
        int width=pixelBuffer->getWidth();
        int height=pixelBuffer->getHeight();
        //printf(“Image size is %i x %i\n”, width, height);
        MsgStr += “Image width is :”;
        MsgStr += width;

//CString cs(MsgStr.c_str());
        MessageBox(NULL,MsgStr.c_str(),“Warning”,MB_OK);
    } else {
        MessageBox(NULL,“Connect to VFB Failed…”,“Warning”, MB_OK);
    }

for some reason pixelBuffer is null and i get connect to vfb failed.
i tried using the const value instead of : EXT_PIXEL_BUFFER_INTERFACE but that also does not work. the declaration for the vrayVFB is : VUtils::VRayVFB *vrayVFB;

any idea what i’m doing wrong ?

cheers

Where do you obtain the vrayVFB variable value from?

Best regards,
Vlado

hmm that is a good question :slight_smile:

i have to check if the vrayVFB is filled with something in this function.
hmm thx. something to look into. i’ll repost when i have something new.

Hmm before get_interface need a vrayVFB.

i declare vrayVFB as : VUtils::VRayVFB *vrayVFB
For getting contense of the vrayvfb do i need to create a new one?

if yes, then i should use:
VRayExport VRayVFB * VUtils::VRayVFB::newDefaultVRayVFB (VRayVFBNotifyCallback *notifyCb, int noGUI)

Perhaps you have can show an example how to do this cause i’m not gettings this to work…

You can obtain a pointer to the current frame buffer if you use the V-Ray renderer interface (e.g. you get a pointer to the current renderer, obtain from it a VRENDER_INTERFACE interface, cast it to a VRenderInterface class and call its method for accessing the current VFB). I don’t have the code in front of me right now, but I’ll check later and post it.

Best regards,
Vlado

hmm i tried something but still doing things wrong :slight_smile: hehehe c++ is hard to get used to. but well i’ll keepon trying. this is what i have sofar:

VRenderInterface *vrender=GetVRenderInterface(GetCOREInterface()->GetCurrentRenderer());
    if (vrender) {
        // Renderer is V-Ray
        //now get a pointer to the vrayrender.. ?
        MessageBox(NULL,“Render is vray”,“Warning”, MB_OK);
        //VR::VRayVFB * getRenderVFB(vrayVFB);
        VUtils::VRayVFB *vrayVFB=static_castVR::VRayVFB\*(getRenderVFB);

VUtils::PixelBufferInterface *pixelBuffer=static_castVUtils::PixelBufferInterface\*(GET_INTERFACE(vrayVFB,LARGE_CONST(2005120901)));
        if (pixelBuffer) {
            int width=pixelBuffer->getWidth();
            int height=pixelBuffer->getHeight();
            //printf(“Image size is %i x %i\n”, width, height);
            MsgStr += “Image width is :”;
            MsgStr += width;

//CString cs(MsgStr.c_str());
            MessageBox(NULL,MsgStr.c_str(),“Warning”,MB_OK);
        } else {
            MessageBox(NULL,“Connect to VFB Failed…”,“Warning”, MB_OK);
        }
    }

btw: tested with the large_const number instead of ext_… to see if it made a difference.

Eh, you are supposed to call the method, not to get its address :slight_smile: It should be like this:

VUtils::VRayVFB *vrayVFB=vrender->getRenderVFB();
if (vrayVFB) {
  // Do something...
}

Best regards,
Vlado