Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. intptr

intptr

Scheduled Pinned Locked Moved Visual Basic
csharpperformancehelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Taylor
    wrote on last edited by
    #1

    i made a delegate of one sub and sent its method.methodhandle.value to a sub in a VisualFortran Dll. the sub in VisualFortran creates an interface to work with this sub and calling it from fortran. this works in vb6 when i send the (addressof sub) to visual fortran but it does not work when the delegate.method.methodhandle.value in vb.net is sent to the fortran dll. i know intptr is not even a CLS-Comapliant but i recieve the error "protected memory ..."

    A.E.K

    D 1 Reply Last reply
    0
    • T Taylor

      i made a delegate of one sub and sent its method.methodhandle.value to a sub in a VisualFortran Dll. the sub in VisualFortran creates an interface to work with this sub and calling it from fortran. this works in vb6 when i send the (addressof sub) to visual fortran but it does not work when the delegate.method.methodhandle.value in vb.net is sent to the fortran dll. i know intptr is not even a CLS-Comapliant but i recieve the error "protected memory ..."

      A.E.K

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Without seeing your code that declares the delegate, the function your calling, and the callback function in your code, it's kind of hard to diagnose. This[^] is about the only thing anyone can recommend.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Without seeing your code that declares the delegate, the function your calling, and the callback function in your code, it's kind of hard to diagnose. This[^] is about the only thing anyone can recommend.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        T Offline
        T Offline
        Taylor
        wrote on last edited by
        #3

        This is the code in VB.NET Private Declare Function dll1 Lib "FileAddress" (ByVal ptr As Integer) as Single Public Delegate Function del1(ByVal p As Single) As Single Dim g1 As del1 = AddressOf proc1 Function proc1(ByVal p As Single) As Single Return p ^ 2 End Function Here is the function Call(in.Net): dll1(g1.Method.MethodHandle.Value) and here the code in VisualFortran: Real function dll1(F) !dec$ attributes dllexport ::dll1 !dec$ attributes alias :'dll1'::dll1 interface real function F(x) real x end end interface end and I recieve this Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Notice that i call back a function in .Net from Visual Fortran (not another .Net) thanx a lot

        A.E.K

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups