Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Propellent Library and Executable v1.0 - Page 2 — Parallax Forums

Parallax Propellent Library and Executable v1.0

2»

Comments

  • hippyhippy Posts: 1,981
    edited 2008-05-31 18:13
    Oldbitcollector said...
    This will permit conditional compile! (On the editor side of course)

    Yes, but ( as I hinted earlier ) that's not the best place to do it.

    Make the Editor a simple Text Editor which calls a DLL/EXE and have the DLL/EXE do the conditional compilation handling which then passes the results on to the next nested DLL/EXE and so on to ultimately arrive at Propellent and then pass the results back up the chain.

    This way everything's a separate module so the tool chain can have things added, removed, replaced and re-ordered without breaking anything, and it minimises effort for anyone working on a module designed for its specific task.

    Added, a picture's worth 1,024 words ...

    .--------.    .-------------.    .-------.    .------------.
    |        |--->| Conditional |--->|  Any  |--->|            |
    | Editor |    | Compilation |    | Other |    | Propellent |
    |        |<---|   Handler   |<---| Tools |<---|            |
    `--------'    `-------------'    `-------'    `------------'
    
    
    

    Post Edited (hippy) : 5/31/2008 6:20:33 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-05-31 18:16
    genius!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook 1.4
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card? - PropDOS
    Need a part? Got spare electronics? - The Electronics Exchange
  • hippyhippy Posts: 1,981
    edited 2008-05-31 18:23
    If PropTool changes to call Propellent we also have an opportunity to fiddle with that, get the 'hooks' people have been after and add conditional compilation etc to the 'genuine PropTool'.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-05-31 22:05
    if you have visual studio then a batch file

    "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe" /EP %2 %3 %1.spin > %1temp.spin
    Propellent.exe /compile %1temp.spin

    will allow the use of the C++ preprocessor
    bat
    130B
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-06-01 00:21
    I have tried to register the dll on Windows XP SP2 without luck using regsvr32.exe - complains about invalid entry point.

    I canot find the equivialent regsvr32.exe in Windows Vista, nor have I founf the "run" command yet (only new to vista). I have loaded both VB6 SP6 and VB2008 Express. I have a serial version of code which receives data from Marine instruments over the NMEA bus and works under VB6.

    Any ideas how to register the dll under vista?
  • TimmooreTimmoore Posts: 1,031
    edited 2008-06-01 01:19
    I assume you mean propellent.dll. It doesn't need registering. It needs to be on the path. Go to control panel->system->advanced->environment varables->path and add the directory you have propellent.dll onto the end of the list of directories.

    In terms of run for vista, open the main menu and type "cmd" without " into·search near the bottom of the meu·and command window will open.
  • JWoodJWood Posts: 56
    edited 2008-06-01 03:22
    Cluso99,
    regsvr32 is used to registry COM libraries only. Propellent.DLL is not a COM library. You must make direct calls to the DLL using the "cdecl" format as the help document says.
    ·
    If you have VS2008 then you can simply use the PropellentNet wrapper I wrote. It's attached to this thread as well as an updated version in my early post. It implements every function available exposing them with the ease of using .Net. I also have a decently extensive Proof of Concept IDE·using the wrapper. It's basically a clone of the Propeller Tool but with a simple text editor for the code editing. Not the fancy one in the office tool.·
    ·
    Jason
    ··· Wood

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-06-01 08:17
    Thanks guys, but obviously I am missing something. I copied propellent.dll to C:/Windows/System 32 which is included in the path as suggested. I still cannot add it into the properties section so I presume I am missing domething to do with the "cdecl" term. Any help would be appreciated to get VB6 (SP6) working. sad.gif

    Update: I now know that "cdecl" is not compatable with Visual Basic without some form of wrapper. This type of dll requires the calling programto pop the stack and VB requires the dll to do that. I have no idea how to make the propellent.dll compatable with Visual Basic. shakehead.gif

    Post Edited (Cluso99) : 6/1/2008 12:20:11 PM GMT
  • hippyhippy Posts: 1,981
    edited 2008-06-01 13:12
    @ Cluso99 : Jason has the code needed to use the Propellent.dll with C# and that should be usable with VB.Net but I'm not your needed expert there.

    For VB6 (SP6) which is what I'm also trying to get working, cdecl is the sticking point. DLL's written for cdecl don't like working with VB6 but it's not impossible. However, I've not got it to work using the tricks I know.

    I've never done anything with mixing VB6 and C/Delphi and so if anyone has and can either solve the used-inside-VB6 problem or create a DLL wrapper to sit between VB6 and Propellent that would be appreciated as development is currently flat on its face an inch off the starting line.

    If I could get this working there wouldn't be any need to worry Jeff/Parallax over annoyances already detailed with Propellent.exe as I'd simply roll my own and development would then speed along.

    I'll keep pushing on with trying to make it work but it's not looking promising so far; either 'Bad DLL Calling Convention' or Protection Fault inside Propellent.
  • JWoodJWood Posts: 56
    edited 2008-06-01 15:30
    hippy and Cluso99,
    I'm easily able to expose my .Net wrapper to the COM world. It's been some time from the last COM development I have done but I'll get something working. With VB6's large limitation of the cdecl Calling Convention I believe most effort done in pure VB6 will be a waste. I'll pull out my VB6 CD's and install it so I can do some testing.·When I get a working library I'll post it here with a MSI installer so you don't need to do any registering.
    ·
    Did either of you try out the small IDE I put together? There is a compiled and working version in the Demo folder of the zip. It wouldn't take much more effort to develop a decent Code Editor like the official tool instead of the basic text editor I used. If people see the value in it I could easily allow 3rd party COM and .Net DLL's to be added on giving any number of functionality. It could very easily allow (like hippy nicely drew below)·for a "man in the middle" pre-processor of the code to take care of compiler derivatives. I love compiler derivatives but more than that I love Intellisense! How often do you have to jump from code file to code file searching for exact names of functions?
    ·
    Any way … I’ll try and get a COM object today. I would like to see this idea of an open source IDE continue. I would be happy to lead a design and development effort to make this goal a reality. I develop interfaces like this as my current job. I’ve just never been allowed to release the code to the open source world.
    ·
    Let me know what you all think.
    ·
    Jason
    ·· Wood



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (JWood) : 6/1/2008 3:36:17 PM GMT
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-06-01 16:46
    JWood

    Jason. That would be excellent smile.gif

    I haven't done much VB programming in the last 5 years. I am reluctant to get into VB.Net as it just looks too hard :-(

    I did try out your .Net code in VB2008 Express but it converted the code and nothing was visible.

    Hippy: I have code working to the com ports for receiving and decoding navigation instruments. I have just started removing all the Smile and getting into shape for driving the com port (2 of them because it makes debugging easier). When I get this into shape I can send you this. I can also do the file capture and sending. I think I mentioned before, I have the Propeller logging data at 12.5nS up to 1mS between samples and outputting the samples (1880 of them) to the serial port in two formats. One is text and the other is in UTF16 so that if you save the file and call it *.spin the Propeller Tool loads it in as a timing diagram smile.gif
  • JWoodJWood Posts: 56
    edited 2008-06-01 17:14
    Cluso99,
    You don't actualy need to use the code directly. You can use the already compiled PropellerNet.dll in the Demo directory. Just add that as a reference in your project and you can access all it's functions like so: (for your ease of use I wrote this example in VB.NET)

    [color=#000033]    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load[/color]
     
    [color=#000033]        Dim tmpPropNet As New PropellentNet.Propellent(0, True, "")[/color]
     
    [color=#000033]        Dim tmpPropVer As PropellentNet.Propellent.PropellerVerson
            tmpPropVer = tmpPropNet.GetPropVersion()
            MessageBox.Show("The propeller Version = " & tmpPropVer.PropVerson.ToString() & vbCrLf & _[/color]
    [color=#000033]
                            "Found on COM Port = " & tmpPropVer.ComPort.ToString())[/color]
    [color=#000033]
            tmpPropNet.Dispose()
     
        End Sub[/color]
    
    

    Thats just one of the functions that gets the version of a Propeller hooked up via USB·and powered on.

    Jason
    ·· Wood

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-06-01 18:38
    JWood said...
    With VB6's large limitation of the cdecl Calling Convention I believe most effort done in pure VB6 will be a waste.

    If it weren't for cdecl, VB6 development would be swimming along nicely already cry.gif

    All that's needed is a Win32 wrapper DLL which presents a stdcall interface to VB6 and changes that to the cdecl interface of Propellent.DLL - Easier said than done for me though. I've got it partially working with PowerBasic PB/Win but have run into a bizarre problem there which I won't bore you with. Suffice to say that after a near straight 14 hours battling with this I'm @#£$ed off with it.

    Your .Net demo shows what can be done, unfortunately I'm not at all familiar with VB/C#.Net and that's just an another obstacle when I could be whizzing along already with VB6.
  • JWoodJWood Posts: 56
    edited 2008-06-01 20:01
    Hippy, I have a little relief for your pain. I attached just about what you need. Just extract the 3 files in the same directory and add your VB reference to the .tlb. You'll have all the functionality with ease.
    ·
    My Installer isn't working·so it's not getting registered correct to use with out browsing to it. As soon as I figure out why that is happening you won’t need to browse to the TLB because the registry will know.
    ·
    This should take care of everything you need to get it working in COM.
    ·
    If you would do me a favor, when you add the reference to the .tlb, tell me what it says its name is in the list view. Working with COM today ... I remember why I abandoned it long ago.

    Let me know Hippy and Cluso99 when you give this a try and how it turned out.

    Jason
    ·· Wood

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-06-01 22:04
    Many thanks Jason. Added the reference and it appeared as "PropellentCOM". Not used TLB's before so not sure what to do with it now but thanks for your efforts, it really is appreciated.

    Went out, 'had a good long scream at the moon' and I finally got PB/Win bashed into shape and have that working so people have the choice of your DLL and TLB or the DLL I've created and my hacked API via Basic Module. No guarantees it's all working as it should but does the basics.

    Once I've had a breather I'll turn it into an ActiveX .OCX for other VB6 users and I'll read up on TLB's and investigate your DLL interface further.

    They say the satisfaction at the end of the climb is inversely proportional to the effort of getting up the hill -- I'm not sure that's entirely true smile.gif

    Added : One very rough and ready ActiveX. Not sure which of those files are needed, where they'll need to be put or whether it will even work ( does on my development PC ).

    Post Edited (hippy) : 6/1/2008 11:05:35 PM GMT
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-06-01 23:50
    Jason & Hippy,

    Many thanks. I will try hopefully later today. hop.gif
  • JWoodJWood Posts: 56
    edited 2008-06-02 00:50
    Hippy, I was checking out your code. Can I make a small suggestion? You have hard pathed your dll references locations. This makes it difficult to use in the masses because people must know to·have the Propellent.dll in a specific place. Instead if you used a soft path this wouldn’t be a problem.
    ·
    You have
    Declare Sub DownloadToPropeller CDecl _
      Lib "C:\Vb\User\Propellent\Propellent.Dll" _
     _
      ( ...
      )
    
    

    Changing it to
    Declare Sub DownloadToPropeller CDecl _
      Lib "Propellent.Dll" _
     _
      ( ...
      )
    
    

    will allow users to place the Propellent.DLL in c:\windows\system32 or in the same directory as the caller and it will work on any computer with out setup. This would also apply for your ActiveX control. I haven't looked at it yet.
    ·


    ·
    Also I wrote my library in an object oriented language and so you have to instantiate the object before you can use it.

        Dim tmpObj As New PropellentCOM.Propellent
        
        MsgBox "GetLibraryPath = " + tmpObj.get_LibraryPath
        MsgBox "GetPorts = " + tmpObj.GetComPorts(True)
        MsgBox "GetResetSignal = " & tmpObj.get_ResetSignal
        MsgBox "GetSerialSearchMethod = " & GetSerialSearchMethod
        MsgBox "GetSerialSearchRules = " + tmpObj.get_SerialSearchRules
    

    I haven't tried all the API calls in my COM object so I'm not sure if the all work as should be. I have tested all the .Net API calls they work just fine.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-06-02 03:06
    Yes should have coded the DLL path differently which would have been more useful, was having no end of trouble with it anyway, wouldn't work without a path even in same directory as the .EXE and I'd reached the end of my patience smile.gif

    Thanks for the quick HowTo on using your object.

    I'm noticing some weirdness with mine. Compilation only gives an error message pop-up not the source line, setting showError false gives no pop-up but doesn't indicate an error. Also getting somewhat corrupted data back from GetSourceHierarchy(). Doesn't seem to give the same results on every execution either; sometimes doesn't report an erorr, sometimes does.

    I think there's a degree of work which needs to still be done to find where the errors are, in the base DLL or in the chain used to interface with it.

    Compilation ( barring above issues ) appears to work okay under 98SE but it won't identify any serial ports. Not too much of a problem as I have a VB6 downloader anyway so can probably vector to the DLL or handle it myself in the ActiveX.
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-06-02 10:23
    Hippy,
    I tried your dll but couldn't get it to compile but it crashed with error 53 - unable to find the file ...propellentforvb6.dll
    I tried placing the dll in the windows/system32 directory. In the end I created a directory the same as yours but still no success.
    I am not sure if it has anything to do with Vista??? It's not easy for me to try with XP as I need to replace the hard drive in my laptop for this (lack of time).

    So I tried your .exe and the same result :-( Didn't have time to see if the ActiveX works.
  • hippyhippy Posts: 1,981
    edited 2008-06-02 13:35
    I was getting those Error 53's as well even when the named file existed. Altering the source code in the DDL itself in insignificant ways would make it come and go - that "bizarre problem with PB/Win" I mentioned earlier. I think VB / Windows gets confused and the error doesn't reflect whatever the real problem is.

    Not sure what to suggest at the moment. I put everything ( all source, Propellent.DLL and PropellentForVB6.DLL ) in the same directory and that worked.

    I'll move both to \System32 and see if I can get that working this time now it's at least working under one configuration.

    Made all the references to "Propellent.DLL" and "PropellentForVb6.DLL" with no disk/path and copied both those DLL's to C:\Windows\System (Win98SE) and everything was working okay for me. Then it got confused and now I get GPF's all over the place.

    This is too much pissing-about and banging of head on wall for me so I'm putting it aside for now.

    Post Edited (hippy) : 6/2/2008 2:07:37 PM GMT
  • matbmatb Posts: 39
    edited 2008-06-02 14:39
    Yippie, command line tool. Much happy! Not exactly a standard command line too, but its way better than nothing! (pop up windows, cwd source path limitation)

    For those new to makefiles, attached is a simple makefile to compile and load any spin file.
    type make blah.ram to load and run blah.spin


    Now I have the Parallax font working under Linux, all I need now is syntax highlighting for vim or some other editor to make my world complete.

    Post Edited (matb) : 6/2/2008 2:45:17 PM GMT
    454B
  • jazzedjazzed Posts: 11,803
    edited 2008-06-02 15:07
    matb have you tried using this with the Eclipse C/C++ plugin?

    The integrated source control would be a clear winner. The build and editor environments should work. The language syntax would obviously be wrong. Can't imagine source browsing declarations and references working, but search would be fine. For a complete Eclipse environment package (minus debugging of course) one would have to create a .spin plugin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • PraxisPraxis Posts: 333
    edited 2008-06-03 11:03
    Hi JWOOD,

    I was just about to start coding a .NET wrapper for the DLL and then I notices that you already have done it.

    Sweet, saved me some time.
  • FireHopperFireHopper Posts: 180
    edited 2008-08-12 15:48
    is anyone working on a mac ide?
Sign In or Register to comment.