Grasshopper

algorithmic modeling for Rhino

I tried to call Fortran subroutine by using GHPython.

when I put this code, these error came out.

However my friend put exactly the same code into GHPython (he put add.dll file into also same place as me), he could do it...

what is this problem?
does somebody know possible solution?Plz tell me!!!

Views: 615

Replies to This Discussion

Could also be that his friend is running 32 bit Rhino. I remember we had some issues with the 32/64 bit thing when implemented ShapeOp (a C++ library) in GHPython.

Sorry for late to reply, I've tried to figure out what you wrote though

I still can't use in GHPython.

and My friend 's path is right.

Maybe read up a bit there Tom..

That was my point, no worries ;) But you're absolutely right, it is certainly not an easy path to go down. Regarding 32 bit: We had some issues when compiling ShapeOp where we would have to target specifically 32 or 64 bit Rhino to get it running. This is also the primary issue with Numpy under IronPython (there is no 64 bit version, hence it is currently not compatible with 64 bit Rhino).

However my friend put exactly the same code into GHPython (he put add.dll file into also same place as me), he could do it...

 

who is this friend??

Also consider the possiblility that your .dll is blocked by windows.

In addition it would be nice if you could send the example and .dlll through in order to replicate the error.

Python file---

from ctypes import *
addmodule = cdll.LoadLibrary('C:\\Users\\Owner\\add4.dll')
addmodule.add4_.argtypes = [ POINTER(c_int),POINTER(c_int),POINTER(c_int) ]
addmodule.add4_.restype = c_void_p

a,b = 4,5
a = c_int(a)
b = c_int(b)
c = c_int()
addmodule.add4_(byref(a),byref(b),byref(c))

print c.value
print b.value

Fortran file---

subroutine add4(a,b,c)
implicit none
real(8),intent(in) :: a
real(8),intent(inout):: b
real(8),intent(inout):: c
integer IT

Open(unit=7, file='TEST.txt')
IT=7

c = a + b
b = a + c

WRITE(IT,*) c , b
end subroutine

here it is. I could load dll file only once, then I can't do it again.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service