Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Calling conventions of dll's

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

    Calling conventions of dll's

    Hi,

    What calling convention uses Alpha Five for external functions in DLL's. Is that cdelc or stdcall?

    Thanks for any help.

    Marcel
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    #2
    RE: Calling conventions of dll's

    Sorry, cdelc must be cdecl.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

    Comment


      #3
      RE: Calling conventions of dll's

      Have you taken a look at this topic in the web help?

      http://support.alphasoftware.com/xbasic_reference/language/declare.htm

      Comment


        #4
        RE: Calling conventions of dll's

        Hi Edward,

        Yes I did, but it is not the solution for me.

        I have a program language with which I can make my own dll. I can choose to make a dll with the calling convention "cdecl" or "stdcall". It has to do with the sequence of the parameters on the stack and who does the clean up of the stack.

        In this case I have to know how Alpha the parameters treats of the declare statement when they're put on the stack.

        Thanks for any help,

        Marcel
        Marcel

        I hear and I forget. I see and I remember. I do and I understand.
        ---- Confusius ----

        Comment


          #5
          RE: Calling conventions of dll's

          Marcel,

          I'm pretty sure it's STDCALL. I wrote a couple of functions in a delphi dll and they are "stdcall'.

          Good luck!
          John Panagia

          Comment


            #6
            RE: Calling conventions of dll's

            John, Thanks a lot.

            Marcel
            Marcel

            I hear and I forget. I see and I remember. I do and I understand.
            ---- Confusius ----

            Comment


              #7
              RE: Calling conventions of dll's

              Hi John,

              Thanks, it's been succesful

              The next PureBasic external function is succesfull called from Alpha Five:

              ProcedureDLL EasyRequester(Message$)
              MessageRequester("EasyRequester !", Message$, #MB_ICONINFORMATION)
              EndProcedure

              With the following Alpha Code:

              'Date Created: 28-Jun-2003 10:15:17 PM
              'Last Updated: 01-Jul-2003 06:24:57 PM
              'Created By :M.Kollenaar
              'Updated By :

              declarestruct text C255text
              declare pb EasyRequester L(text)
              dim string as P
              string.text = "Hi"
              EasyRequester(string)

              Again, thanks a lot!

              Now I have a reference point to start with!

              Marcel
              Marcel

              I hear and I forget. I see and I remember. I do and I understand.
              ---- Confusius ----

              Comment


                #8
                RE: Calling conventions of dll's

                Marcel,

                Great, I'm glad it worked.

                Looking at your Alpha code confuses me. I've seen it before and it always makes me think to hard.

                Your decs:
                declarestruct text C255text
                declare pb EasyRequester L(text)
                dim string as P

                string is a pointer with a sub-field of "Text" or is it being type-cast as Text. How does A5 associate the string and the text declaration?

                Then you set a value and call you function:

                string.text = "Hi"
                EasyRequester(string)

                How does EasyRequester find the text field? Is it just looking at the beginning of the variable string?

                I realize this is an Alpha thing, I just have trouble grasping it.

                Thanks

                Comment


                  #9
                  RE: Calling conventions of dll's

                  Hi John,

                  Thanks for your reply. I will explain what and why I did what I did. I'm a novice in Alpha/XBasic so the confusion is not as rare as you think. I started last week with a piece of code from http://learn alpha.com/PieCharts/PieCharts.htm. Peter Wayne made an example analog at some visual basic code and made a translation to XBasic. I took this as an example.
                  Marcel

                  I hear and I forget. I see and I remember. I do and I understand.
                  ---- Confusius ----

                  Comment


                    #10
                    RE: Calling conventions of dll's

                    Is this a better approach?


                    '--------------------------------------------
                    'Date Created: 28-Jun-2003 10:15:17 PM
                    'Last Updated: 01-Jul-2003 11:09:44 PM
                    'Created By :M.Kollenaar
                    'Updated By :

                    declarestruct text C255text
                    declare pb EasyRequester L(text)
                    dim string as {text}
                    string.text = "Hi, put some text here!"
                    EasyRequester(string)
                    '--------------------------------------------


                    Marcel
                    Marcel

                    I hear and I forget. I see and I remember. I do and I understand.
                    ---- Confusius ----

                    Comment


                      #11
                      RE: Calling conventions of dll's

                      Marcel,

                      If that works it is much more understandable. I wasn't suggesting you change the code. I was trying to understand what seems to be a common enough coding practice using A5. For me the issue is the programmer must except something at face value that is not obvious. Any experienced programmer that has never used Alpha will look at this kind of thing and say, Ouch!

                      Thanks for your explanation

                      John

                      Comment


                        #12
                        RE: Calling conventions of dll's

                        Hi,

                        Yes, I got it working. I wrote a piece of code in PureBasic, made a DLL of it and called it from Alpha Five. XBasic can't find files with attributes set to NORMAL. This one does!

                        ; Information
                        ; Name: pbAttrib.dll
                        ; Synopsis: pbAttrib(Path.s,FileName.s,FileAttributes.s)
                        ; Parameters: Path.s Path to the directory where files resides.
                        ; FileName Filename or wildcards: *.txt, a*.?x?
                        ; FileAttributes one of the collection AaRrSsHh
                        ; Uppercase set an attribute, lowercase reset an attribute.
                        ; Returns: nothing
                        ; Globals: None
                        ; Description: An alternative external function to set and reset file attributes
                        ; for Alpha Five.

                        ; File Attribute Constants
                        ; #PB_FileSystem_Hidden: File is hidden
                        ; #PB_FileSystem_Archive: File has been archived And not changed since the last time
                        ; #PB_FileSystem_Compressed: File is compressed
                        ; #PB_FileSystem_Normal: Normal attributes
                        ; #PB_FileSystem_ReadOnly: File is in readonly mode
                        ; #PB_FileSystem_System: File is a system file

                        ProcedureDLL SetAttributes(Path.s, FileName.s, FileAttributesToChange.s)

                        DefType.l FileAttributes, NewFileAttributes, pos
                        DefType.s SingleAttribute

                        If ExamineDirectory(0,Path,FileName)
                        Repeat
                        FileType = NextDirectoryEntry()
                        ;
                        ;-Existing Filetypes
                        ; 0: no more entry in the directory
                        ; 1: this entry is a file
                        ; 2: this entry is a directory
                        ;
                        If FileType = 1
                        FileName = DirectoryEntryName()
                        MessageRequester("File: ",FileName,0)
                        ;
                        ; Process atributes
                        ;
                        FileAttributes = DirectoryEntryAttributes()

                        For pos = 1 To Len(FileAttributesToChange)
                        SingleAttribute = Mid(FileAttributesToChange,pos,1)
                        Select SingleAttribute
                        Case "a"
                        If ((FileAttributes & #PB_FileSystem_Archive) = #PB_FileSystem_Archive)
                        FileAttributes ! #PB_FileSystem_Archive ;XOR
                        EndIf
                        Case "A"
                        If ((FileAttributes & #PB_FileSystem_Archive) = 0)
                        FileAttributes | #PB_FileSystem_Archive ;OR
                        EndIf
                        Case "r"
                        If ((FileAttributes & #PB_FileSystem_ReadOnly) = #PB_FileSystem_ReadOnly)
                        FileAttributes ! #PB_FileSystem_ReadOnly ;XOR
                        EndIf
                        Case "R"
                        If ((FileAttributes & #PB_FileSystem_ReadOnly) = 0)
                        FileAttributes | #PB_FileSystem_ReadOnly ;OR
                        EndIf
                        Case "s"
                        If ((FileAttributes & #PB_FileSystem_System) = #PB_FileSystem_System)
                        FileAttributes ! #PB_FileSystem_System ;XOR
                        EndIf
                        Case "S"
                        If ((FileAttributes & #PB_FileSystem_System) = 0)
                        FileAttributes | #PB_FileSystem_System ;OR
                        EndIf
                        Case "h"
                        If ((FileAttributes & #PB_FileSystem_Hidden) = #PB_FileSystem_Hidden)
                        FileAttributes ! #PB_FileSystem_Hidden ;XOR
                        EndIf
                        Case "H"
                        If ((FileAttributes & #PB_FileSystem_Hidden) = 0)
                        FileAttributes | #PB_FileSystem_Hidden ;OR
                        EndIf
                        EndSelect
                        Next pos
                        MessageRequester("Debug","File: " + Path + FileName,0)
                        If SetFileAttributes_(Path + FileName, FileAttributes) = 0
                        MessageRequester("Setfileattributes","Failure",0)
                        EndIf

                        EndIf
                        Until FileType = 0
                        Else
                        MessageRequester("Error","Can't examine this directory.",0)
                        EndIf
                        EndProcedure

                        ;SetAttributes("C:\","*.txt","AR")

                        End

                        +++++++++++++++++ end of the PureBasic code +++++++++++++++

                        The following Xbasic code calls the external function in the DLL. The function resets the attributes of *.txt files.

                        ----------------- start of XBasic code --------------------
                        'Date Created: 28-Jun-2003 10:15:17 PM
                        'Last Updated: 04-Jul-2003 12:22:06 AM
                        'Created By :M.Kollenaar
                        'Updated By :

                        declarestruct ptext C255ptext
                        declarestruct ftext C255ftext
                        declarestruct atext C255atext
                        declare pbAttrib SetAttributes L(ptext)(ftext)(atext)

                        ptemp.ptext="c:\\"
                        ftemp.ftext="*.txt"
                        atemp.atext="ar"

                        result = SetAttributes(ptemp,ftemp,atemp)

                        ---------------- end of XBasic code ------------------

                        I want to thank all the users and Alpha people for the input.

                        Marcel Kollenaar
                        Marcel

                        I hear and I forget. I see and I remember. I do and I understand.
                        ---- Confusius ----

                        Comment

                        Working...
                        X