How to link to a dll in vb.net

C

Chris

I have a DLL that I would like to use in VB.NET but I am not sure how to
link to it. It is called PerlinDLL.dll and is a dll that spits out a bitmap
of a fractal image.(link:
http://www.stanford.edu/~jjshed/perlin/index.html ) I do have the code that
I believe allows a C# program hook to it, but I do not know how to do it in
VB.NET. Where does the dll need to reside? system32 directory? My programs
bin directory?

Here is the C# code:

[DllImport("PerlinDLL.dll")]
static extern unsafe void TestBMP(void* ARGB32_pixels, int w, int h);
[DllImport("PerlinDLL.dll")]
static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int
w, int h);
[DllImport("PerlinDLL.dll")]
static extern void SetPerlinVars(float init_freq, float init_amp, float
persistance, int octaves, int random_seed);
[DllImport("PerlinDLL.dll")]
static extern void SetLinearInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void SetCosineInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void SetCubicInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void InitializePalette(int r1, int g1, int b1, int r2, int
g2, int b2);
[DllImport("PerlinDLL.dll")]
static extern void AddColor(float pos, int r, int g, int b);
[DllImport("PerlinDLL.dll")]
static extern int GetColor(float f);
[DllImport("PerlinDLL.dll")]
static extern void SetClampAbs();
[DllImport("PerlinDLL.dll")]
static extern void SetClampTruncate();
[DllImport("PerlinDLL.dll")]
static extern void SetClampNormalize();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputFlat();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputTileable();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputSphereMapped();

What is the vb.net equivilant?

Thank you so much!

Chris
 
K

Ken Tucker [MVP]

Hi,

http://msdn.microsoft.com/library/d.../en-us/vbcn7/html/vaconCallingWindowsAPIs.asp

Ken
--------------
I have a DLL that I would like to use in VB.NET but I am not sure how to
link to it. It is called PerlinDLL.dll and is a dll that spits out a bitmap
of a fractal image.(link:
http://www.stanford.edu/~jjshed/perlin/index.html ) I do have the code that
I believe allows a C# program hook to it, but I do not know how to do it in
VB.NET. Where does the dll need to reside? system32 directory? My programs
bin directory?

Here is the C# code:

[DllImport("PerlinDLL.dll")]
static extern unsafe void TestBMP(void* ARGB32_pixels, int w, int h);
[DllImport("PerlinDLL.dll")]
static extern unsafe void GeneratePerlinTexture(void *ARGB32_pixels, int
w, int h);
[DllImport("PerlinDLL.dll")]
static extern void SetPerlinVars(float init_freq, float init_amp, float
persistance, int octaves, int random_seed);
[DllImport("PerlinDLL.dll")]
static extern void SetLinearInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void SetCosineInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void SetCubicInterpolation();
[DllImport("PerlinDLL.dll")]
static extern void InitializePalette(int r1, int g1, int b1, int r2, int
g2, int b2);
[DllImport("PerlinDLL.dll")]
static extern void AddColor(float pos, int r, int g, int b);
[DllImport("PerlinDLL.dll")]
static extern int GetColor(float f);
[DllImport("PerlinDLL.dll")]
static extern void SetClampAbs();
[DllImport("PerlinDLL.dll")]
static extern void SetClampTruncate();
[DllImport("PerlinDLL.dll")]
static extern void SetClampNormalize();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputFlat();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputTileable();
[DllImport("PerlinDLL.dll")]
static extern void SetOutputSphereMapped();

What is the vb.net equivilant?

Thank you so much!

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top