473,388 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

function prototype

When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcAddress return (void*)
When I use 2nd line in prototypes, compiler fails in last line because (void*) is not a function prototype.
So, what cast I must use?
Can you rewrite these 3 lines correctly?
With 1st line in prototypes, I used:
glCompressedTexImage2DARB =
(void (*glCompressedTexImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcAddress("glCompressedTexImage2DARB") ;
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTexImage2DARB;

//load function
glCompressedTexImage2DARB = SDL_GL_GetProcAddress("glCompressedTexImage2DARB") ;

//use function
glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);
Jul 22 '05 #1
1 2904
<- Chameleon -> wrote:
When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcAddress return (void*)
When I use 2nd line in prototypes, compiler fails in last line because (void*) is not a function prototype.
So, what cast I must use?
Can you rewrite these 3 lines correctly?
With 1st line in prototypes, I used:
glCompressedTexImage2DARB =
(void (*glCompressedTexImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcAddress("glCompressedTexImage2DARB") ;
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTexImage2DARB;

//load function
glCompressedTexImage2DARB = SDL_GL_GetProcAddress("glCompressedTexImage2DARB") ;
glCompressedTexImage2DARB = reinterpret_cast<void (*)(GLenum ,GLint,
GLenum, Glsizei, const void
*)>(SDL_GL_GetProcAddress("glCompressedTexImage2DA RB"));
//use function
glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Rob Somers | last post by:
Hey people, I read a good thread on here regarding the reason why we use function prototypes, and it answered most of my questions, but I wanted to double check on a couple of things, as I am...
41
by: Telmo Costa | last post by:
Hi. I have the following code: -------------------------------------- function Tunnel() { //arguments(???); } function Sum() { var sum = 0; for (i=0; i<arguments.length; i++) sum +=...
17
by: Matt Kruse | last post by:
Perl's map() function is a powerful shortcut to accomplish many "loop over an array and do X" operations. Below is a quick hack to simulate similar functionality. I've used it a few times and find...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
3
by: Jeff Stewart | last post by:
I've been working with the JavaScript Shell in Firefox on a mad-scientist problem I've had in my head. Assume a function named 'object' that is designed to create an object based on a prototype...
20
by: Christian Christmann | last post by:
Hi, in a benchmark I've found an uncommon use of a function. This is the simplified form: 1 int foo( int f ) 2 { 3 return f; 4 } 5
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
5
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
1
by: wkerplunk | last post by:
Below is what I have build with several different languages. It works great but I need help, I am stuck. When you click on an item in the dropdown autocomplete div it does a mousedown function...
2
by: hzgt9b | last post by:
I know how to overwrite a function. Normally this is what I would do: function someFunction() { /* orig definition here */ } //later in the execution stream I would do... someFunction = function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.