Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Import VHTK DLL file in H3D using C++
#1
Quite a regular
Quite a regular


See User information
Hi all,

I was wondering would you be able to help. I am trying to import the vhtk.dll file that comes with the newest version of H3D (i.e. H3D2.1). When using X3D, I can import the dll file and use it's nodes.

<!-- IMPORT TO MAKE THE VHTK NODES ACCESSIBLE  --> 
<
ImportLibrary library="importsVHTK.dll" />   

<!--  
SET THE SPECIFICS FOR THE VHTK NODES    -->     <VolumeHaptics stiffness="250" />        
<
ScalarViscosityMode DEF="Volume_Mode" active="false">     
<
ScalarConstantField DEF="Field" size "10 10 10" />     
<
ConstantFunction 
    containerField
="viscosity"       
    
DEF="Visc_const"       
    
value="0.55"/>   
</
ScalarViscosityMode>

But I am trying to do this completely using C++, but am finding it difficult to understand exactly how to do this. I presume you need to use the ImportLibrary.h file and point it to the location of the VHTK DLL file. But then how do I access the nodes, like the ones I have access up above? Any help would be greatly appreciated

AutoRefImportLibrary import_lib( new ImportLibrary );     
import_lib->setName("../Plugins/VHTK_vc9.dll");

Posted on: 2009/12/2 12:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Import VHTK DLL file in H3D using C++
#2
Webmaster
Webmaster


See User information
If you want to create the nodes in c++ (without using the createX3DFrom.. functions) you have to compile against VHTK, using the headers from it and linking with the .lib file. Then you don't have to do anything in your code to load the VHTK.dll since your program is already dependent on it.

The best way to load a dynamic library in C++ is to use the DynamicLibrary::load function

Posted on: 2009/12/2 13:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Import VHTK DLL file in H3D using C++
#3
Quite a regular
Quite a regular


See User information
Thanks for the reply Daniel.

I have tried to use the DynamicLibrary load function. I have tried to do this by doing the following:

DynamicLibrary::LIBHANDLE handle;     
handle DynamicLibrary::load"../Plugins/VHTK_vc9.dll" );

Upon compiling the program, I get the following error

error LNK2019unresolved external symbol "__declspec(dllimport) public: static struct HINSTANCE__ * __cdecl H3D::DynamicLibrary::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?load@DynamicLibrary@H3D@@SAPAUHINSTANCE__@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Zreferenced in function _main

I presume once the dynamic link library has been loaded successfully, I can just run the following, and then use all the attributes of the VolumeHaptics node.

AutoRefVolumeHaptics vh( new VolumeHaptics );


Am I doing something wrong here

Posted on: 2009/12/2 18:04
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Import VHTK DLL file in H3D using C++
#4
Webmaster
Webmaster


See User information
Yes, you are doing something wrong

The linking error is because you have not linked H3DUtil(which contains the DynamicLibrary code) to your program.

If you want to use VHTK in the way you specify e.g. with new VolumeHaptics, you should not do any of this load at all. What you should do is include the proper header file from VHTK, probably "include or something similar, and then link to VHTK.lib.

Posted on: 2009/12/3 10:45
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





(C) 2012 SenseGraphics AB    ---    Powered by XOOPS