1、首先用vs2008新建一个win32-》win32 project->DLL工程,需要设置好coin3d 编译的环境,然后添加一个源文件,代码如下
ifdef TESTDLL_EXPORTS
#define TESTDLL_API __declspec(dllexport)
#else
#define TESTDLL_API __declspec(dllimport)
#endif
#include <Inventor/Win/SoWin.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoQuadMesh.h>
#include <Inventor/Win/SoWin.h>
#include <Inventor/Win/viewers/SoWinExaminerViewer.h>
class TESTDLL_API Ctestdll
{
public:
void PassHandle(HWND hwnd);
};
void Ctestdll::PassHandle(HWND hwnd)
{
SoWin::init("");
SoWinExaminerViewer* viewer = new SoWinExaminerViewer(hwnd);