473,657 Members | 2,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function prototype

When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcA ddress 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:
glCompressedTex Image2DARB =
(void (*glCompressedT exImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcA ddress("glCompr essedTexImage2D ARB");
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedT exImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTe xImage2DARB;

//load function
glCompressedTex Image2DARB = SDL_GL_GetProcA ddress("glCompr essedTexImage2D ARB");

//use function
glCompressedTex Image2DARB(GL_T EXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);
Jul 22 '05 #1
1 2910
<- Chameleon -> wrote:
When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcA ddress 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:
glCompressedTex Image2DARB =
(void (*glCompressedT exImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcA ddress("glCompr essedTexImage2D ARB");
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedT exImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTe xImage2DARB;

//load function
glCompressedTex Image2DARB = SDL_GL_GetProcA ddress("glCompr essedTexImage2D ARB");
glCompressedTex Image2DARB = reinterpret_cas t<void (*)(GLenum ,GLint,
GLenum, Glsizei, const void
*)>(SDL_GL_GetP rocAddress("glC ompressedTexIma ge2DARB"));
//use function
glCompressedTex Image2DARB(GL_T EXTURE_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
3835
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 writing something up on functions, and I don't like writing about things I am not sure about. Ok, then, here we go: I initially thought that one would only really need to use a function
41
2547
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 += arguments;
17
2011
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 it to be quite handy. Any thoughts? <script type="text/javascript"> function map(func) { var i,j,o; var results = ;
3
3644
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' that takes arguments of type (void *) because the ADT must be able to deal with any type of data. In my actual code, I will code the function to take arguments of their real types, then when I pass this pointer through an interface function, I...
3
1394
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 object -- the semantic is that the returned object prototypally inherits from the argument 'o'. function object(initializer, o) { if (!o) o = Object; function f() {} f.prototype = o;
20
2358
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
4305
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
2233
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
3842
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 and send the item number to the xmlHttp and works awesome. Now I need to add an apply button next to it. so they can type in the complete number then hit apply and it does the same function. I cant get it to work with the script I have. The image...
2
6458
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 () { /* overwrite function definition */ } The above works fine for me even when someFunction is originally defined in a seperate frame other than the code that overwrites it (obviously on the same domain). What I don't know how to-do is...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.