473,794 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to link to older C code without IDL conflicts?

TOM
I am using C++.NET 2003. The appplication requires calling a device (a USB
driver) that was compiled under C++ 6.0, and distributed as a binary (a .sys
file) by the manufacturer. Some of the data structures are fairly complex,
and a couple header files from the Windows DDK are needed to establish the
variable types and structures needed to call the USB functions.

The problem is that an #include of the necessary DDK headers within C++
auto-generated Windows forms modules fails to compile due to numerous
conflicts between the (new) and the (old) IDLs.

In .C++.NET 2002 I was able to hold the structures as part of the wrapper
module, as long as they were not part of a function or method interface.
This broke in .NET 2003, and now I have to hide the offending data
structures inside the methods as automatic variables so that they never are
exposed outside the module. I cannot make them part of the wrapper
interface, since that requires that auto-generated modules to have to
#include the DDK headers. Within the wrapper module, I use P/Invoke to call
the low level USB calls in the .SYS module.

So, it works, but the wrapper is very unelegant. It cannot save device state
between calls since that would require declaring a structure and #includes
which would then break all the other modules.

Is there another approach that would allow use of these proprietary USB data
structures (and the necessary #includes from the DDK) that would allow
static varables that are not exposed outside the wrapper module?

-- Tom

Nov 17 '05 #1
2 1286
Compile with /d1PrivateNative Types to get back to the VC 2002 behavior in
this respect. There is a KB article describing the issue (googling for the
flag name should find it) along with a few posts by myself. In the Whidbey
version of VC we will be providing a method to control visibility of native
types individually.

Ronald Laeremans
Visual C++ team

"TOM" <no****@noprovi der.nodomain> wrote in message
news:eL******** ******@TK2MSFTN GP12.phx.gbl...
I am using C++.NET 2003. The appplication requires calling a device (a USB
driver) that was compiled under C++ 6.0, and distributed as a binary (a ..sys file) by the manufacturer. Some of the data structures are fairly complex, and a couple header files from the Windows DDK are needed to establish the
variable types and structures needed to call the USB functions.

The problem is that an #include of the necessary DDK headers within C++
auto-generated Windows forms modules fails to compile due to numerous
conflicts between the (new) and the (old) IDLs.

In .C++.NET 2002 I was able to hold the structures as part of the wrapper
module, as long as they were not part of a function or method interface.
This broke in .NET 2003, and now I have to hide the offending data
structures inside the methods as automatic variables so that they never are exposed outside the module. I cannot make them part of the wrapper
interface, since that requires that auto-generated modules to have to
#include the DDK headers. Within the wrapper module, I use P/Invoke to call the low level USB calls in the .SYS module.

So, it works, but the wrapper is very unelegant. It cannot save device state between calls since that would require declaring a structure and #includes
which would then break all the other modules.

Is there another approach that would allow use of these proprietary USB data structures (and the necessary #includes from the DDK) that would allow
static varables that are not exposed outside the wrapper module?

-- Tom


Nov 17 '05 #2
TOM
Thanks for the link and pointer to the subject! Found the KB article, and
this sounds like what is happening.

-- Tom

Nov 17 '05 #3

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

Similar topics

3
2129
by: eric rudolph | last post by:
I am writing a photo gallery and suppose 8 photos are displayed. When the user clicks on a button under the picture, I want it to add that picture name to a "favorites" list within the session data, but NOT leave the page the user is on. How could I do this? thanks
2
1757
by: Dennis M. Marks | last post by:
I have seen partial answers to the following question but I am not sure of the best approach. I have a page that will only work with javascript. The link to the page indicates that. Within the page I have a clickable link to a function. The best html for that process seems to be: <a href="xxx" onclick="TheFunction(); return false">CLICK HERE</a> I assume the "return false" causes the href to be ignored but the function will be called....
7
3403
by: LRW | last post by:
Below I'll paste my CSS and the HTML in question. But what's happening is, I'm trying to establish a link behavior for a class that's separate from the normal link class. I've established a: 's with no underline and then an underline for hover...but oddly, only ONE link will actually show the underline on hover. All the rest, even with the same HTML, won't pop up an underline. I just don't get it! If I could get any advice I'd really...
0
1642
by: Xiaofeng Zhang | last post by:
when I compile my project setting, there are many LINK errors. But when I compile my project under debug setting, everything is OK. How can I deal with it? The errors is followed. Linking... LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrt.lib(MSVCR71.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrt.lib(MSVCR71.dll)
6
2071
by: jameshamilton777 | last post by:
I want to make my website properly accessible. I want to assign keys that navigate to a different page when pressed. I've looked into the accesskey attribute, but under IE that involves pressing the ALT key with the accelerator, and then pressing return. Is there a way that you can define an access key to just follow a link, without pressing ALT and without having to press RETURN?
6
7492
by: John | last post by:
Hi I have a front-end/back-end access app. I have created a replication set between the backend on a server an the backend on a laptop. My question is; How can I cause the synchronisation to happen via code? Basically I need to give the user an option to press a button (or menu option) on the laptop when the laptop is connected to the server/network for synchronisation to happen. Thanks
13
2704
by: Derek | last post by:
As I understand it there is a good amount of link compatibility among C compilers. For example, I can compile main.c with GCC and func.c with Sun One and link the objects using either linker (GNU or Sun). What I'm curious about is why this compatibility exists in the absence of a standard C ABI? What encourages C compiler vendors to agree on implementation issues such as alignment, packing, etc., such that their object
3
2272
by: Alex Shturm | last post by:
Hi, I am trying to activate incremental link using VC7 (.NET 2003) on a pretty big project (executable size is more than 100Mb, and it gets linked from several dozen of libraries and object files of different sizes - from less than 1Mb to tens of MBs). The problem is that option /incremental:yes does not have any effect on the link time. I observe that the linker removes existing executable and re-links it from scratch.
5
4690
by: Bruce | last post by:
I am getting a lot of link errors when compiling in the debug build but not release. I am compiling a CLR managed code class library. I believe the link errors are actually being caused by a static library of unmanagaed code. I think the problem comes from the fact that the unmanaged static lib uses the STL. Any idea how to fix this?
0
9671
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10212
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...
1
10161
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,...
0
9035
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...
0
6777
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
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.