Re: Use of sizeof()
- Posted by jimcbrown (admin) Oct 27, 2009
- 1132 views
Hi
Is there any way of using sizeof() from Euphoria.
Sorry, no. sizeof() is an *operator*, not a function (or even a macro). So it only exists at compile time and is evaluated by the compiler.
I wish to find the size of a structure created by a lib, but I don't know which dll/so to open. (also I want to find the size of a bitmap or image in memory, but first step is to experiment with sizeof())
Normally, you'd consult that library's documentation to learn this. However, in the specific case of structures, there is nothing exported by the dll. This information is going to be in a header file (the library's documentation should tell you which header file), and you will need to transcribe it from the C into Eu.
Also, if I was going to use other C functions, what reference material would I use to find out for myself which dll/so to open (eg malloc)
Chris
On Linux, normally just using a man page is enough. My version of man page for malloc() doesn't state which library to use however, but in this case it is /lib/libc.so.6
There are also man pages online (as HTML), e.g. http://linux.die.net/man/3/malloc
On Windows, MSDN (msdn.microsoft.com) is the source to hit. e.g. http://msdn.microsoft.com/en-us/library/ms687404(VS.85).aspx