<div dir="ltr">I'km using Kitware VTK which is in C#<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 14, 2014 at 5:23 PM, ferluduena <span dir="ltr"><<a href="mailto:xpelaox@gmail.com" target="_blank">xpelaox@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi! I've been making some progress with VTK, and my idea is to build a .dll<br>
in Visual studio, where I use VTK, and then, use it on a C# application.<br>
<br>
I have my VTK project, which i made using CMake, which is a console<br>
application, and looks like this:<br>
<br>
//---------------------------------------------------------------------------//<br>
#include <vtkVersion.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkPolyData.h><br>
#include <vtkXMLPolyDataWriter.h><br>
#include <vtkContourFilter.h><br>
#include <vtkGaussianSplatter.h><br>
#include <vtkPolyDataMapper.h><br>
#include <vtkActor.h><br>
#include <vtkRenderWindow.h><br>
#include <vtkRenderer.h><br>
#include <vtkRenderWindowInteractor.h><br>
#include <vtkJPEGReader.h><br>
#include <vtkImageData.h><br>
#include <vtkImageViewer2.h><br>
#include <vtkOrientationMarkerWidget.h><br>
#include <vtkAxesActor.h><br>
#include <vtkSurfaceReconstructionFilter.h><br>
#include <vtkReverseSense.h><br>
<br>
void recon(int x, int y, int z);<br>
void recondemo(void);<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
int key = 0;<br>
cout << "Ingresar 1 Para reconstruir imagenes a partir de archivos, o 0<br>
para demo" << endl;<br>
cin >> key;<br>
if (key == 1)<br>
{<br>
int x, y, z;<br>
x = y = z = 0;<br>
recon(x, y, z);<br>
}<br>
else<br>
{<br>
recondemo();<br>
}<br>
return EXIT_SUCCESS;<br>
<br>
}<br>
<br>
void recon(int x=0, int y=0, int z=0){}<br>
<br>
void recondemo(void){}<br>
<br>
//----------------------------------------------------------------------------//<br>
<br>
So what i tried to do is going to the project's configuration in VS and<br>
change Type of configuration from .exe to .dll.<br>
<br>
after compiling i tried calling the .dll from a C# application, but when i<br>
run it i get an error saying the format is incorrect.<br>
<br>
This is how i call the function in c#:<br>
<br>
<br>
//------------------------------------------------------------------------------------//<br>
class PlatformInvokeTest<br>
{<br>
[DllImport("EmbedPointsIntoVolume.dll")]<br>
public static extern int recodemo();<br>
[DllImport("EmbedPointsIntoVolume.dll")]<br>
internal static extern int _flushall();<br>
//------------------------------------------------------------------------------------//<br>
}<br>
<br>
So, i'm pretty sure this can be done... but can someone give me an idea on<br>
how? I've read about different ways of calling a .dll ... but i'm pretty<br>
sure i'm not building the .dll right, to begin with.<br>
<br>
Hope someone can help me!<br>
<br>
Thanks in advance!<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Creating-a-dll-with-VTK-tp5727853.html" target="_blank">http://vtk.1045678.n5.nabble.com/Creating-a-dll-with-VTK-tp5727853.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>