473,396 Members | 1,834 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,396 software developers and data experts.

Create Function Pointer from IntPr

Hi all.

I'm working with the Tao OpenGL libraries for C# but ran into a problem
getting a function to work.

What I've done is:

// Set current context
Wgl.wglMakeCurrent(hDC, hRC);

// get entry point of the function
IntPtr pfnColorTableEXT = Wgl.wglGetProcAddress("glColorTableEXT");

// I have a value other than Zero at this point.
// How do I create a delegate or function pointer to this entry point?
Any help would be appreciated.

Dennis
Nov 16 '05 #1
3 3293
check out this for info

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconusingcallbackfunctions.asp

and check this out for the answer

http://groups.google.co.uk/groups?hl...A.2300%40TK2MS
FTNGP10.phx.gbl&rnum=1&prev=/groups%3Fq%3Ddelegate%2520from%2520IntPtr%26hl%
3Den%26lr%3D%26sa%3DN%26tab%3Dwg

cool code or what :)
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.
"Dennis Vansickle" <De*************@discussions.microsoft.com> wrote in
message news:2E**********************************@microsof t.com...
Hi all.

I'm working with the Tao OpenGL libraries for C# but ran into a problem
getting a function to work.

What I've done is:

// Set current context
Wgl.wglMakeCurrent(hDC, hRC);

// get entry point of the function
IntPtr pfnColorTableEXT = Wgl.wglGetProcAddress("glColorTableEXT");

// I have a value other than Zero at this point.
// How do I create a delegate or function pointer to this entry point?
Any help would be appreciated.

Dennis

Nov 16 '05 #2
>and check this out for the answer

http://groups.google.co.uk/groups?hl...A.2300%40TK2MS
FTNGP10.phx.gbl&rnum=1&prev=/groups%3Fq%3Ddelegate%2520from%2520IntPtr%26hl%
3Den%26lr%3D%26sa%3DN%26tab%3Dwg

cool code or what :)


Except that what the original poster was asking for was the opposite;
getting a delegate from a function pointer. That's non-trivial to do
in v1.x but easy in v2.0.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #3
realised that after I hit 'send' :)

Ollie

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:O5**************@TK2MSFTNGP14.phx.gbl...
and check this out for the answer

http://groups.google.co.uk/groups?hl...HA.2300%40TK2M

S
FTNGP10.phx.gbl&rnum=1&prev=/groups%3Fq%3Ddelegate%2520from%2520IntPtr%26hl

%
3Den%26lr%3D%26sa%3DN%26tab%3Dwg

cool code or what :)


Except that what the original poster was asking for was the opposite;
getting a delegate from a function pointer. That's non-trivial to do
in v1.x but easy in v2.0.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #4

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

Similar topics

9
by: iceColdFire | last post by:
HI, I have a function as void f(int p) { return p++; } now I have created a function pointer as
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
5
by: Try Kret | last post by:
Hello ! I was wondering how to create a function that can be applied to all type of variables? If we use for example, sortList(void *obj), we can not do the comparison of 2 strcut. ...
9
by: Eric Lilja | last post by:
Hello, I'm a novice C++ programmer and now I have the task of converting a number of C++ functions to C. Some of the functions I'm converting takes a parameter of type reference-to-std::string...
8
by: TJ | last post by:
I need to be able to pass a pointer to a (managed code) Stream object to a COM method so it can serialize its data into the stream. I have a C# application that makes uses of Randolf Duke's...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
14
by: Lambda | last post by:
I'd like to create separate character pointers, pass them to a function to assign each one different value, and assign the pointers to an array. But when I try: #include <stdio.h> #include...
40
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.