flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
JohnFound 09 Jul 2014, 06:03
In FreshLib/StrLib the strings are represented not by addresses, but by handles. That is because the actual address of the string can change when the string grows. These are dynamic strings.
So, DataMD5 and StrMD5 procedures returns a handle of a string, containing the string representation of the MD5 hash. How to handle it? 0. There is no need to call itoa. The returned string already contains the MD5 hash in string form. 1. The current string address can be retrieved by calling StrPtr and passing the handle to it. 2. To free the memory allocated for the string, call StrDel procedure, passing the handle of the string. |
|||
![]() |
|
clamicun 09 Jul 2014, 06:24
Jesus,
thank you JF. That was a very fast answer. Ok. I got it. |
|||
![]() |
|
JohnFound 09 Jul 2014, 06:31
How to import functions from dynamic libraries in FreshLib.
1. Create a file with the description of the imported functions. The description uses the macro "import_proto": Code: macro import_proto library, [iname, arg, ename] Here: - "library" is the name of the library. In Linux it is a string, in Windows, just the name of the DLL. - iname - the name of the function, as imported - this is the label of the function for the program. - arg - a list of the function arguments, closed in "<" and ">". All arguments must be local - i.e. starting with dot. Can be "<VOID>" if the function has no arguments. Can be "<NONE>" if the arguments are not known, or the user don't want to describe them right now. This list is needed only for the arguments hint feature in Fresh IDE, it is not mandatory, but highly useful. - ename - string with the name of the function as exported in the DLL. As an example for this kind of include files see "freshlib/imports/" directory - all files in the subdirectories are of this type (for Linux and for Windows). The user created files can be placed wherever the user wants. 2. In the program, use the macro uses in order to request the use of the dynamic library: Code: macro uses [library] Here is an example: Code: uses User32, kernel32, mylib:"path_to_the_import_file/mylib.inc" If the path is not specified (like kernel32 in the above example), the default path "%lib%/imports/%TargetOS%/library#.inc" is used. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.