[vtkusers] Creating a .dll with VTK.
ferluduena
xpelaox at gmail.com
Mon Jul 14 16:23:52 EDT 2014
Hi! I've been making some progress with VTK, and my idea is to build a .dll
in Visual studio, where I use VTK, and then, use it on a C# application.
I have my VTK project, which i made using CMake, which is a console
application, and looks like this:
//---------------------------------------------------------------------------//
#include <vtkVersion.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkContourFilter.h>
#include <vtkGaussianSplatter.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkJPEGReader.h>
#include <vtkImageData.h>
#include <vtkImageViewer2.h>
#include <vtkOrientationMarkerWidget.h>
#include <vtkAxesActor.h>
#include <vtkSurfaceReconstructionFilter.h>
#include <vtkReverseSense.h>
void recon(int x, int y, int z);
void recondemo(void);
int main(int argc, char *argv[])
{
int key = 0;
cout << "Ingresar 1 Para reconstruir imagenes a partir de archivos, o 0
para demo" << endl;
cin >> key;
if (key == 1)
{
int x, y, z;
x = y = z = 0;
recon(x, y, z);
}
else
{
recondemo();
}
return EXIT_SUCCESS;
}
void recon(int x=0, int y=0, int z=0){}
void recondemo(void){}
//----------------------------------------------------------------------------//
So what i tried to do is going to the project's configuration in VS and
change Type of configuration from .exe to .dll.
after compiling i tried calling the .dll from a C# application, but when i
run it i get an error saying the format is incorrect.
This is how i call the function in c#:
//------------------------------------------------------------------------------------//
class PlatformInvokeTest
{
[DllImport("EmbedPointsIntoVolume.dll")]
public static extern int recodemo();
[DllImport("EmbedPointsIntoVolume.dll")]
internal static extern int _flushall();
//------------------------------------------------------------------------------------//
}
So, i'm pretty sure this can be done... but can someone give me an idea on
how? I've read about different ways of calling a .dll ... but i'm pretty
sure i'm not building the .dll right, to begin with.
Hope someone can help me!
Thanks in advance!
--
View this message in context: http://vtk.1045678.n5.nabble.com/Creating-a-dll-with-VTK-tp5727853.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list