Unable to call custom HDK/Vex function

   3367   8   1
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
Hello,

I been going through the HDK docs and was able to compile a couple examples successfully.

One such as SOP_Start.C I am able to compile and making sure it's .dll is in the right directory and with new instance of Houdini can find it under TAB menu of network window and lay it down.

However after reading the section on custom VEX functions although I can compile successfully the VEX_Ops.C file,

I cannot call the ‘sticky’ function in a point wrangle.

VEX_Ops.C [www.sidefx.com]

From hconfig I see what my $HFS path is

HFS := 'C:/PROGRA~1/SIDEEF~1/HOUDIN~1.705'

and from hconfig -ap I find the reference to vex path
HOUDINI_VEX_DSO_PATH := "@/vex"
    The search path for loading custom VEX functions.

    Default path: '@/vex'
        Where @ is replaced with HOUDINI_DSO_PATH
    Directories searched (in order) are:
        1) "$HFS/houdini/dso/vex"

It appears by default the path is set to look for custom VEX functions in $HFS/houdini/dso/vex

So I put the VEX_Ops.dll file in that directory.

But when call ‘sticky’ I get an error saying it's not defined.

Help is appreciated - Thanks.
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
Isn't the point wrangler a cvex context operator? If so, sticky is not available for it as described in source code. This endeavor of yours into HDK world seems to be little harsh recently
Edited by symek - 2017年10月10日 15:26:52
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
Isn't the point wrangler a cvex context operator?

Hah…I don't know…thanks for the clue though…looks like I will have to chew on this section of the HDK docs then.

CVEX [www.sidefx.com]
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
I read the section I thought would help…but as I read it, it seemed it wasn't the context of what I wanted to do.

I still don't understand what that implies about the point wrangler being a cvex operator.

But from this post it seems I was on track regardless, because this person was able to get it working in their attempt.
(I changed to try the same example file as this person did in my second attempt)

http://forums.odforce.net/topic/26502-about-vex_examplec-make-build-in-vex-function/ [forums.odforce.net]

And they are calling the function from a wrangler.

They initially couldn't get it working until someone pointed out they neglected to set up their file right referring to this part of the HDK documentation:

Installing the Plug-In

The last thing required to install your DSO function is to create a table in the Houdini path so that the VEX engine can find your plug-ins. The table lists the location of the dynamic link objects which should be loaded by the VEX engine. For example (on Unix):
% echo vex/myfunc.so > ~/houdiniVERSION/vex/VEXdso

This tells VEX to look for the first occurrence of the file vex/myfunc.so in your HOUDINI_DSO_PATH path. With the default HOUDINI_DSO_PATH, the above table entry would tell the VEX engine to search for a sub-directory in the HOUDINI_DSO_PATH (run “hconfig -ap” for more information).

This example is done using linux, so maybe I don't understand the windows equivalent but I assumed that my .lib file should be inserted into this VEXdso file, which I found and opened to enter it. But when I opened that file and looked at it I found this saying it's depreciated.

#ifndef __HFS_VEXdso__
#define __HFS_VEXdso__

//
// This file is now deprecated. All dynamic libs in the
// $HOUDINI_VEX_DSO_PATH are automatically loaded.
//

#endif

The part about
$HOUDINI_VEX_DSO_PATH are automatically loaded.
confuses me because when I was reading the docs under the Major Changes section it basically said the same thing which is why I never did this step and instead just setup like in my original post - the .lib file in the directory indicated by $HOUDINI_VEX_DSO_PATH which the results of hconfig -ap shows that my system is looking there.

Help is appreciated - thanks
Edited by BabaJ - 2017年10月11日 10:48:17
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
BabaJ
I still don't understand what that implies about the point wrangler being a cvex operator.

sticky example has a context flag set to OP and SHADING context, so it's not available in cvex context ifaik, which point wrangler uses under the hood.

Checkout dsoinfo -v to find out if your dso is properly installed.
User Avatar
Member
402 posts
Joined: 6月 2014
Offline
Hey BabaJ,

I think you might have picked a doosey for getting into hdk land

Firstly, the Vex_Ops file you linked to above has the whole code body wrapped in a ‘#if defined(LINUX)’ preprocessor directive, and from the look of your HFS, you're on windows, no? So the code will happily compile, but it is as far as the compiler is concerned, empty.

I *think* the reason for the linux platform check is because of the call to getpid() which isn't supported on the windows platform, try taking out the #if/#endif and the compiler should complain about the identifier not being found, because now it's actually found some code to (try and) compile.

Of course, what symek pointed out is also true. That you need to tell houdini which contexts you want the function to be available in.

I'd say checkout another file if you want to play with custom functions in SOP wrangles: maybe this one may give you more of a start here [www.sidefx.com]. Notice the use of VEX_ALL_CONTEXT as argument in VEX_VexOp constructor calls, and also the slightly more helpful use of the preprocessor directives to do platform checking on a per-function basis.

I hope that's somehow useful and if I've said anything daft, somebody please give me a virtual poke in the eye!
Henry Dean
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
Ok that makes sense since the section of the HDK docs on custom vex functions has two sample files:

The one with ‘sticky’ comes from SOP_Start.C and creates a .dll file.

But the second example, which the guy on odforum used is from Example.C

https://www.sidefx.com/docs/hdk15.5/_v_e_x_2_v_e_x__example_8_c-example.html [www.sidefx.com]

And this is the one where he can use the myprint function in a wrangle.

So when I compile that one I get a .lib file, not a .dll.

But I must be misunderstanding or misinterpreting where and how the ‘dso’ should be installed.

I did the dsoinfo -v and it lists nothing. As a double check for my own clarity, just running dsoinfo gives all the other ‘ones’.

So I went back to houdini console and ran hconfig -ap again, which shows:



HOUDINI_VEX_DSO_PATH := "@/vex"
    The search path for loading custom VEX functions.

    Default path: '@/vex'
        Where @ is replaced with HOUDINI_DSO_PATH
    Directories searched (in order) are:
        1) "$HFS/houdini/dso/vex"



So I thought, ok maybe that's just the for default vex functions for the houdini installation…
So in my houdini documents directory where the current version of Houdini I am using is in that has the .env file also.

I added a vex folder to the dso folder and put the .lib file there.

I then opened a new instance of houdini and hip file and typed dsoinfo -v.

And nothing shows.


Edit:

And after adding that vex folder and .lib file I went back to hconsole and again ran hconfig -ap and got the new folder showing:



HOUDINI_VEX_DSO_PATH := "@/vex"
    The search path for loading custom VEX functions.

    Default path: '@/vex'
        Where @ is replaced with HOUDINI_DSO_PATH
    Directories searched (in order) are:
        1) "$HOUDINI_USER_PREF_DIR/dso/vex"
        2) "$HFS/houdini/dso/vex"

Edited by BabaJ - 2017年10月11日 13:31:11
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
I missed your post friedasparagus while I was posting my most recent post.

Will check it out and work with that.

Thanks everyone so far.
User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
Ok…yeah..the link friedasparagus supplied was the second example I tried, and the same one by the guy used from the odforce forum.(In which he was able to use a function from it)

So I am guessing I am not going about it right in setting up the directory/file and how to have Houdini looks for it.
  • Quick Links