Announcement

Collapse
No announcement yet.

Python and PowerBASIC DLLs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cliff Nichols
    replied
    Unfortunately its a case of "What Changed???" pure and simple.
    Aka:
    What was the original intent? vs How is it called? vs what changed how its called.

    For lack of a better word "Its never NOUN for Noun and VERB for Verb", but given the right handling the translation will make sense to both

    I get the point of how huge the original is..but if you can post a example (thats if you can even find the same trouble point (or your best guess) then maybe someone here can point out something you missed)

    Leave a comment:


  • Michael Mattias
    replied
    If you need an explicit BYREF (as in byref(s1) and byref(s2)) to pass params by reference, your call line needs that for dll_in,heatex_key and dll_out, since that's what your DLL is expecting.

    Leave a comment:


  • Edwin Knoppert
    replied
    You may have a call stack problem??

    Leave a comment:


  • Edwin Knoppert
    replied
    All params are passed byref.
    Don't know how you declare in python but ASCIIZ is probably incorrect for example.

    Leave a comment:


  • Erich Schulman
    replied
    Python comes in various flavors. Iron Python is the one that supports .net. C Python has separately downloadable Win32 extensions that provide API and COM support. Of course, that won't help you if you're running Python on a non-Win32/64 system.

    Leave a comment:


  • Krister Olsson
    replied
    MY DLL is about 11000 lines of code and I do not know which part of it that I should cut out.

    One of the subs that causes problem is declared in the DLL like this

    SUB Get_Calculation(B1 AS BYTE, B2 AS BYTE, HeatexIn AS DOUBLE, sHeatexType AS ASCIIZ, B3 AS BYTE, B4 AS BYTE, HeatexOut AS DOUBLE) EXPORT

    The call from Python looks like this

    windll.THEDLL.GET_CALCULATION( byref(s1), \
    byref(s2), \
    dll_in, \
    heatex_key, \
    byref(z1), \
    byref(z2), \
    dll_out )


    Krister Olsson

    Leave a comment:


  • Edwin Knoppert
    replied
    No, i was unclear.
    He mentions VB.NET and he's using PB8 so i rule out he has the use of a com server at this time.

    Due the fact he had so much 'success' it should not give a guarantee.
    If he used python and is returning a string from the PB dll it may be released wrong.
    Other languages may not have that impact but still wrongly used.

    The caller needs to destroy the return value.

    assuming, assuming.. we don't know anything again, no code..

    Leave a comment:


  • jcfuller
    replied
    Originally posted by Edwin Knoppert View Post
    Often returning a string to .NET is totally wrong handled.
    Due the fact you actually see the contents but in fact the translation was poor (and may GPF yes)..

    While PB9 does not work as anticipated(me) with .NET it should be able to be used with slight different syntax.
    Rewritting the dll to a comserver is then a must and probably wise due the fact that parameters are threated differently.
    (You won't have to deal with PINVOKE as you do now)

    If python is able to load com servers.. it may be the best option.
    ??

    I did not see any mention of .NET or PB9 in the posters question.

    James

    Leave a comment:


  • Edwin Knoppert
    replied
    Often returning a string to .NET is totally wrong handled.
    Due the fact you actually see the contents but in fact the translation was poor (and may GPF yes)..

    While PB9 does not work as anticipated(me) with .NET it should be able to be used with slight different syntax.
    Rewritting the dll to a comserver is then a must and probably wise due the fact that parameters are threated differently.
    (You won't have to deal with PINVOKE as you do now)

    If python is able to load com servers.. it may be the best option.

    Leave a comment:


  • Krister Olsson
    started a topic Python and PowerBASIC DLLs

    Python and PowerBASIC DLLs

    I have written a DLL using PB/Win, that latest version of the DLL using ver 8.04. My company has used this DLL from VB6 and PowerBASIC for several years without ANY problems at all. A lot of customers have used the DLL from their programs written in VC++, Delphi, VB.net and VB6. Now I have got a customer that tries to call the DLL from Python. He has problems. From he error report:
    "But I still get these mysterious crashes of the python runtime after I made
    a call to the dll. I can't track the problem down to a specific point
    because sometimes it crashes while my application is still running and
    sometimes nothing happens at all, everything works as expected but most of
    the time it happens when I exit it. Do you have any more ideas? Because I
    have none".
    Is it possible to design a PB DLL that behaves like this in Python, which I never have used myself, but is rock solid in VB6? Has anybody used Python with PB DLLs?

    Krister Olsson
Working...
X