Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help: Using Library from GNU in VB2008

  1. Aug 4, 2009 #1
    Hey guys,

    Im trying to use the library in GNU in VB2008 to generate random number with uniform distribution (actually will also use it for other distributions)...I already added dll under bin file and try to run the following code, but just cant make it work:

    Public Class Form1
    Declare Function gsl_rng_uniform Lib "C:\vb\uniform\uniform\bin\Debug\libgsl.dll" (ByVal x As Double, ByVal y As Double) As Double

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim rr As Double
    rr = gsl_rng_uniform(1.0, 10.0)
    End Sub
    End Class

    It could be built with no problem and when I tried to run it, the following mistake poped out pointing to the "rr = gsl_rng_uniform(1.0, 10.0)":
    Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    Anybody here knows what cause this problem? Or anybody here knows how to generate random variables with normal/uniform/exponetial/... distributions? ( i mean use some library, not by coding from the very beginning...)

    I appreciate ur time reading it and help.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted