Visual C++ Libs?
-
- Enthusiast
- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
Visual C++ Libs?
Since the new linker supports them... How do we go about using these libs? Can we just throw them in the UserLibraries directory? or is it more complicated?
Last edited by PolyVector on Fri May 07, 2004 3:24 am, edited 1 time in total.
Re: Visual C++ Libs?
And how to make the editor to 'see' the commands on those libs?PolyVector wrote:How do we go about using these libraries? Can we just throw them in the UserLibraries directory? or is it more complicated?
ARGENTINA WORLD CHAMPION
You have to identify the functions in the library and the parameters required for each function. The library can then be placed anywhere along the path that windows will search for libraries when they are needed -- generally this includes the \windows\system and \windows directory, the application directory, the current directory, and the directories listed in the PATH environmental variable.
The information concerning the library functions are usually provided in DECLARE statements in include or header files, but may also be referenced in source files. While there are tools to help you recognize the name of the functions in the library, these cannot expose the number of parameters or type of parameters, so either find the files with the DECLARE statements, or be prepared to do a lot of experimenting.
For the rest of it, you need to find out how to use PureBasic in conjunction with libraries, which is not terribly difficult, but redundant if I tried to explain it again here.
The information concerning the library functions are usually provided in DECLARE statements in include or header files, but may also be referenced in source files. While there are tools to help you recognize the name of the functions in the library, these cannot expose the number of parameters or type of parameters, so either find the files with the DECLARE statements, or be prepared to do a lot of experimenting.
For the rest of it, you need to find out how to use PureBasic in conjunction with libraries, which is not terribly difficult, but redundant if I tried to explain it again here.
has-been wanna-be (You may not agree with what I say, but it will make you think).
-
- Enthusiast
- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
- tinman
- PureBasic Expert
- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
I guess as long as you write the .desc file and then run the libMaker tool - since that is the normal way to create a UserLibrary (combine a .lib and .desc file) then it should be possible.PolyVector wrote:I didn't mean DLLs... I meant Lib files...
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
Externally declared and referenced libraries follow a format that Windows recognizes and uses for loading the DLL when needed. External libraries that cannot be loaded dynamically would mean that they have to be linked by a linker after the source is compiled, or require a compiler/linker to join them directly to the executable file. DLLs are an advance over the older library structure, and older libraries would still require a LINK program or something similar to make them an integrated part of the executable. Technically, you might be able to create a DLL wrapper for an older library so that it could be used as needed when the referencing program runs, but it would require a closer look at the DLL specification to see how this would be done.
has-been wanna-be (You may not agree with what I say, but it will make you think).
-
- Enthusiast
- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
perhaps this will help viewtopic.php?t=9711
-
- Enthusiast
- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
taken from the jacks post:
http://freak.purearea.net/tools/
There you can get "libimporter" wich is what you need (i think)
http://freak.purearea.net/tools/
There you can get "libimporter" wich is what you need (i think)
Off the topic (again)
Speaking of libraries, a couple of years ago I was trying to find a library that would handle some really large integers, so that I could work a GOS (grade of service) measurement for some really large trunk groups. Above a certain size, a trunk group should have virtually no blockage of calls, but customers often ask for a number for one reason or another, and I like to be as exact as possible.
I wasn't able to find one at the time, but this thread got me to look for one again, and now I can find one by searching on BIG INT (big integer).
What I wasn't expecting is the area where I found it - cryptography. The modern secret of cryptogoraphy is to use fantastically large numbers, usually primes or non-repeating fractions, to code whole messages and eliminate the redundancies and groupings of certain characters that tend to give away simple substitution codes.
Anyway, a BIG INT library can be very useful for many applications, not just cryptography or working our large factorals, but also for essentially unbounded number representation and calculations. I just figured I would pass the information along. There are commerical pricings and licenses involved, but it is essentially free to the experimenter and educator.
http://indigo.ie/~mscott/
I wasn't able to find one at the time, but this thread got me to look for one again, and now I can find one by searching on BIG INT (big integer).
What I wasn't expecting is the area where I found it - cryptography. The modern secret of cryptogoraphy is to use fantastically large numbers, usually primes or non-repeating fractions, to code whole messages and eliminate the redundancies and groupings of certain characters that tend to give away simple substitution codes.
Anyway, a BIG INT library can be very useful for many applications, not just cryptography or working our large factorals, but also for essentially unbounded number representation and calculations. I just figured I would pass the information along. There are commerical pricings and licenses involved, but it is essentially free to the experimenter and educator.
http://indigo.ie/~mscott/
has-been wanna-be (You may not agree with what I say, but it will make you think).
You can try the APM userlib by freedimension. It should be able to handle large numbers
as well:
http://www.purearea.net/pb/english/index.htm
Timo
as well:
http://www.purearea.net/pb/english/index.htm
Timo
quidquid Latine dictum sit altum videtur
you may also check out http://www.rossi.com/ , there's a bigint and bigfpc routines, and placed in the public domain by the author.
but for a polished package and freeware (whatever that means) check out apfloat at http://www.apfloat.org/
but for a polished package and freeware (whatever that means) check out apfloat at http://www.apfloat.org/
Last edited by jack on Mon Jul 05, 2004 10:17 pm, edited 1 time in total.
just out of curiosity i tried the famous gmp dll, to my disappointment gmp has no trig or log functions.
you can download the dll from http://www.cs.nyu.edu/exact/core/gmp/
here are some examples of use.
you can download the dll from http://www.cs.nyu.edu/exact/core/gmp/
here are some examples of use.
Code: Select all
;you can download gmp from http://www.cs.nyu.edu/exact/core/gmp/
Structure mpz ; multiprecision integer
mp_alloc.l
mp_size.l
mp_limb.l
EndStructure
Structure mpq ; multiprecision rational
mp_num.mpz
mp_den.mpz
EndStructure
Structure mpf ; multiprecision floating point
mp_prec.l
mp_size.l
mp_expt.l
mp_limb.l
EndStructure
i.mpz
j.mpz
k.mpz
n.mpq
m.mpq
q.mpq
x.mpf
y.mpf
z.mpf
OpenConsole()
ConsoleTitle ("GMP.DLL test")
If OpenLibrary(1, "GMP.DLL")
; integer -------------------------------------------------------------------------
CallCFunction(1,"__gmpz_init",i); initialize integer number i
CallCFunction(1,"__gmpz_init",j); initialize integer number j
CallCFunction(1,"__gmpz_init",k); initialize integer number k
CallCFunction(1,"__gmpz_set_str",i,"3333333333",10)
; set i equals to 3333333333 number base 10
CallCFunction(1,"__gmpz_set_str",j,"3333333333",10)
; set j equals to 3333333333 number base 10
CallCFunction(1,"__gmpz_mul",k,i,j); k= i*j
a$=Space(63000);allocate space
CallCFunction(1,"__gmp_sprintf",a$,"%Zd",k);convert integer to string in a$
PrintN(a$); print integer number
; rational ------------------------------------------------------------------------
CallCFunction(1,"__gmpq_init",n); initialize rational number n
CallCFunction(1,"__gmpq_init",m); initialize rational number m
CallCFunction(1,"__gmpq_init",q); initialize rational number q
CallCFunction(1,"__gmpq_set_str",n,"4/12",10); set n equals to 4/12 number base 10 (1/3)
;The string can be an integer like "41" or a fraction like "41/152".
;The fraction must be in canonical form (see Chapter 6 [Rational Number Functions], page 42),
;or if not then mpq_canonicalize must be called.
CallCFunction(1,"__gmpq_canonicalize",n); set n equals to 1/3 number base 10
CallCFunction(1,"__gmpq_set_str",m,"1/5",10); set m equals to 1/5 number base 10
CallCFunction(1,"__gmpq_add",q,n,m);q=n+m
a$=Space(63000);allocate space
CallCFunction(1,"__gmp_sprintf",a$,"%Qd",q);convert rational to string in a$
PrintN(a$); print rational number
; floating point ------------------------------------------------------------------
CallCFunction(1,"__gmpf_init2",x,256); initialize float number x with 256 bits precision
CallCFunction(1,"__gmpf_init2",y,256); initialize float number y with 256 bits precision
CallCFunction(1,"__gmpf_init2",z,256); initialize float number z with 256 bits precision
CallCFunction(1,"__gmpf_set_str",x,"2",10); set x equals to 2 number base 10
CallCFunction(1,"__gmpf_sqrt",y,x) ; y = sqrt(x)
a$=Space(2000)
CallCFunction(1,"__gmp_sprintf",a$,"%40.30Fe",y); convert floating point number y to string in a$
PrintN(a$) ; print float number y
CallCFunction(1,"__gmpf_pow_ui",z,y,2); z=y^2
a$=Space(2000)
CallCFunction(1,"__gmp_sprintf",a$,"%40.30Fe",z)
PrintN(a$)
Print("press the return key to end. ")
b$=Input()
CallCFunction(1,"__gmpz_clear",i); deallocate memory
CallCFunction(1,"__gmpz_clear",j)
CallCFunction(1,"__gmpz_clear",k)
CallCFunction(1,"__gmpq_clear",n)
CallCFunction(1,"__gmpq_clear",m)
CallCFunction(1,"__gmpq_clear",q)
CallCFunction(1,"__gmpf_clear",x)
CallCFunction(1,"__gmpf_clear",y)
CallCFunction(1,"__gmpf_clear",z)
CloseLibrary(1)
EndIf
CloseConsole()
Last edited by jack on Sat Oct 21, 2006 1:50 am, edited 1 time in total.
I think the argument goes that Big Interger math has to round to the nearest integer, and that trig and log functions involve fractions that can extend out many places without ever achieving a precise result.
We all know that there are fractions that cannot be resolved exactly, regardless of how many places they are carried to, such as the value of PI. We also know that there are repeating fractions, which often means that the number is rational, but it just cannot be expressed properly in a decimal (or possibly a binary) numbering system, such as 1/3rd has to be extended out: 0.3333333333333... an infinite number of places.
We also believe that though the set of rational numbers is infinite, and the set of irrational numbers is infinite, that the set of irrational numbers is infinitely larger than the set of rational numbers (has this ever been proven, by the way?).
In any case, in terms of the real world, a fractional apple, person, or penny has no real significance. We deal with absolutes. A divided apple goes bad. A divided person does not become two half-persons, and a penny represents a unit of one in an economic system that uses pennies.
The importance of a big integer process is that it cannot be exceeded by any process native to it, and we can apply it to any number of real world issues, from astronomy to world finance to cryptogoraphy.
Now admittedly, aside from finance, some of those issues require higher forms of mathematics, but that often means using a process to achieve the desired result that can be done on big integers, rather than one that is derived as a shortcut and which uses imprecise fractions.
We all know that there are fractions that cannot be resolved exactly, regardless of how many places they are carried to, such as the value of PI. We also know that there are repeating fractions, which often means that the number is rational, but it just cannot be expressed properly in a decimal (or possibly a binary) numbering system, such as 1/3rd has to be extended out: 0.3333333333333... an infinite number of places.
We also believe that though the set of rational numbers is infinite, and the set of irrational numbers is infinite, that the set of irrational numbers is infinitely larger than the set of rational numbers (has this ever been proven, by the way?).
In any case, in terms of the real world, a fractional apple, person, or penny has no real significance. We deal with absolutes. A divided apple goes bad. A divided person does not become two half-persons, and a penny represents a unit of one in an economic system that uses pennies.
The importance of a big integer process is that it cannot be exceeded by any process native to it, and we can apply it to any number of real world issues, from astronomy to world finance to cryptogoraphy.
Now admittedly, aside from finance, some of those issues require higher forms of mathematics, but that often means using a process to achieve the desired result that can be done on big integers, rather than one that is derived as a shortcut and which uses imprecise fractions.
has-been wanna-be (You may not agree with what I say, but it will make you think).