473,840 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Int32 * to int * for CLS compliancy.

While I'm experienced with c# and regular c++, I'm very new to managed
c++ so please bare with me.

Here's the scenario:

I have a function that wraps a pointer to an unmanaged function. I want
the wrapping function to be CLS compliant.

Here's what I have now. It works perfectly, but isn't CLS compliant:

void gle::GenBuffers ARB( int number, int * buffer )
{
glGenBuffersARB (number, buffer);
}

glGenBuffersARB is the pointer to the unmanaged function. The second
parameter must be a pointer to an unmanaged int. I tried using Int32s
in the function pointer declaration, but that causes
system.typeload exception. And before you mention it, yes I do have to
use a function pointer to use this function, you can't do simple
external declarations for OpenGL extensions.

I would like something like this:

void gle::GenBuffers ARB( Int32 number, Int32 * buffer )

This is CLS compliant: the second parameter is seen as ref int by c# and
byref by vb.net.

How would I convert a reference to a managed Int32 into a pointer to an
unmanaged int? I looked at __box, but that creates a copy. This won't
work because glGenBuffersARB must change the original "buffer" int
passed to the wrapping function. Even if I could do something like
this, that would help:

copy numbers from Int32 buffer to a new int
pass pointer to the new int to glGenBuffersARB
copy the modified numbers in the int back to the Int32
Nov 17 '05 #1
1 1416
haha never mind, a blonde moment. I whipped up a very easy solution:

void gle::GenBuffers ARB( Int32 number, Int32 * buffer )
{
int tempbuffer = *buffer;
int tempnumber = number;

gle::glGenBuffe rsARB( tempnumber, &tempbuffer );
*buffer = tempbuffer;
}

voila
Nov 17 '05 #2

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

Similar topics

3
1861
by: Caleb Hattingh | last post by:
Hi all I saw it on a webpage a few days ago, can't seem to find it again. Tried a google search for "pypy needed translate C modules" but that didn't turn up what I was looking for. Anyone have that page ref handy listing the C modules that the pypy team need translated into python?
11
3844
by: spipyeah | last post by:
Is there a collection of C++ source files that can be used to test compiler compliancy by using really extreme language cases, making sure the standard library is complete, and other such things?
1
1710
by: Majed | last post by:
hi, I'm trying to convert some .h files to API Declaration to use the function and structs. one of it is this: NTMS_GUID CurrentLibrary; // the current library NTMS_GUID MediaPool; // media pool that the media belongs to NTMS_GUID Location; // actual location of the media
5
1615
by: P. | last post by:
Hi, I'm looking for a set of C tests/library which can be used to check ANSI C (C99) compliancy. For instance a set of C tests which can be used to test compiler ANSI C compliancy. I appreciate your help, P.
3
1141
by: VBDotNETCoder | last post by:
Does any one know of any 508 Compliancy Tools for ASP.NET to help automate the process before deployment.
6
23344
by: Ramakrishnan Nagarajan | last post by:
Hi can any one help me in converting a DataView into a DataSet or a DataTable into a DataSet, I tried the following ways dSet= ((DataSet)_gridRegStudDetails.DataSource); dSet = ((DataSet)_gridRegStudDetails.DataSource).Tables.DataSet; studData = ((DataSet)dView).Tables.DataSet; But not working can you pls help me out
3
2217
by: HKannen | last post by:
Hello Everybody, I wrote a little method that gets me an Int32 from a BitArray. This method looks like this: private Int32 GetIntVal( BitArray iArray ) { Byte lByteArr = new Byte; iArray.CopyTo( lByteArr, 0 );
5
9639
by: vtjumper | last post by:
I'm building a C# interface to an existing messaging system. The messaging system allows values of several types to be sent/recieved over the interface. What I want to do is use a generic class to produce values in the system. For instance I could create class MsgGenericValue<UInt16>() which would represent an unsigned value on the interface.
2
1716
by: chriscoder33309 | last post by:
greetings all. I am now coding in Java due to a new employer and was previously a C#/vb.net coder. I wanted to know how to accomplish the below in Java (NetBeans). In C# I always separated my web method logic into their own class files for ease of development and future portability. Your assistance is appreciated. C# Sample Web Method: public SellHouse sellHouse(Int32 transactionId, Int32 customerId, string assetId, int assetPrice)
0
9699
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
10924
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...
0
10605
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9444
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7839
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
7023
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
5685
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4078
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.