473,396 Members | 2,038 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.

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 1266
Compile with /d1PrivateNativeTypes 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****@noprovider.nodomain> wrote in message
news:eL**************@TK2MSFTNGP12.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
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...
2
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...
7
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...
0
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......
6
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...
6
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...
13
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...
3
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...
5
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...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.