Welcome, Guest. Please login or register.

Author Topic: Forgive the use of windows, but I need help !  (Read 2508 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Forgive the use of windows, but I need help !
« on: May 17, 2005, 05:11:56 PM »
I've recently resumed (!) some C programming (in windows though), now the problem I've ran into is this: I'm trying to access a function through a pointer to it by declaring the pointer as void and then try to call the function with:


*funcPtr();

and:

*(funcPtr)();

and even:

(*(funcPtr))();

Yes, I realize I'm drunk ( :-D ), so tell me, how do I do ?
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #1 on: May 17, 2005, 05:58:49 PM »
Dammit people, why dont you respond ?  :-(
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #2 on: May 18, 2005, 01:24:54 PM »
Thanx for your responce, however, what's casting ?
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #3 on: May 18, 2005, 01:28:37 PM »
Quote

Jose wrote:
BTW, that probably won't work either I don't think C allows using a void * as a function pointer.


That's pretty stupid is'nt it ? WHY wouldnt the compliler
allow such accessing one figures !!
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #4 on: May 19, 2005, 01:08:51 PM »
I'm still interested of help if you people wonder.  :-D
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #5 on: May 19, 2005, 02:18:35 PM »
Quote

LinchpiN wrote:



I asked for a simple declaration for a function-pointer, not your inner and outer state in front of a mirror dude.  :-)
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: Forgive the use of windows, but I need help !
« Reply #6 on: May 19, 2005, 02:24:24 PM »
Quote

countzero wrote:
http://www.newty.de/fpt/fpt.html#defi

google and you shall find

casting is casting a type to a pointer. like, you can declare the function parameter as a void pointer, then you can cast it to a specific type and use it.

int myWindozeFunction (void * groovy, int what)

if (what == 1)
int * myIntPtr = (int *) groovy;

something like this...



Thank you, appreciate the help.
I have spoken !