Solved

Creating a driver in Borland? Incompatibility Borland/MS Visual Studio?

Posted on 2004-04-06
5
459 Views
Last Modified: 2013-12-14
I want to use a Firewire camera with a program I've written in Borland C++ Builder 6. The problem is that I can't get it working in Borland.

Here are some details:

I have the source code of a Firewire driver (CMU). I compile the driver (.SYS) with DDK and I compile the library (.DLL) with Microsoft Visual Studio .NET. Then, I link it to a project compiled in MS Visual Studio .NET and everything works.

The thing is, I want to compile my project in Borland for various reasons. Now, I can't just link my Borland project to the DLL compiled in MS Visual Studio, because of an incompatibillity issue. So I want to compile the driver and .DLL immediately in Borland. Like that, everything is compiled in Borland and I won't encounter incompatibilities.

The problems:
First, I don't know how to compile the driver (.sys) in Borland. I have no idea. So I continue to use the .sys file created by the DDK of windows.
Secondly, I was able to create the DLL in Borland. It compiled. However, My program is not able to initialize the camera. (and this was no problem in the Windows project mentioned earlier).

Basically, what I'm looking for is some explanation about how to make drivers in Borland and about the possible problems that exist when using a .SYS generated by DDK with a .DLL generated by Borland.

I hope I made myself clear. Hoping for a clear answer.

Thanks,
Arnoud
0
Comment
Question by:Klaren
  • 2
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
Comment Utility
1st of all, forget about compiling the driver with BCB - it is both cumbersome (if possible at all) and unecessary, since drivers are accessed via 'CreateFile()' and 'DeviceIoControl()'. If your program is not able to initialize the camera, there's a different problem.
0
 
LVL 4

Expert Comment

by:PerryDK
Comment Utility
It is possible.  The problem lies in the fact that the dll's are not compatible with both compilers.  So what you need to is convert the Microsoft DLL (which is in coff format) to one that is compatible with the borland compilers (which expect the omf format)

Go to your C prompt.

type coff2omf  c:\Microsoft\Some.dll c:\Borland\Some.dll

obviously the path names and the name of the dll will differ but hope you get the picture.

This will generate a .lib file which you need to add to your borland project.

If you get an error about missing the dll when you run you app place the dll in the same directory as your executable or place it in the system32 directory.

Hope this helps.  Do a search on google or borlands community pages for coff vs omf if you want to know the details about this.

If you have any other questions about this issue just ask.
0
 
LVL 86

Expert Comment

by:jkr
Comment Utility
DLLs are always PE. The .lib formats differ.
0
 

Author Comment

by:Klaren
Comment Utility
Using coff2omf is not going to help me I'm afraid, because that only works with C code, not with C++ (classes).
Here is an interesting link about that: http://www.bcbdev.com/articles/vcdll2.htm

I've tried to convert the LIB from VC to Borland, but there are no nice ways of doing it. I have been adviced to recompile in Borland, since I have the source code myself.

As I understand from jkr, there is no need to try to compile the .SYS with Borland. Thanks for that.
So what's left, is my the problem of not being able to initialize the camera after compiling it in Borland, although I didn't have a problem with the VC compiled version. Does anybody have any experience in this area? What kind of difficulties exist that I'm not aware of?



0
 

Author Comment

by:Klaren
Comment Utility
Hi,

No answers have been submitted during the last week, so it's time to reward the writer of the accepted answer.

Unfortunately, my problem has not been solved. However, thanks to jkr I'm not trying to find out how to create  a .sys in Borland anymore. I appreciate the extended answer of PerryDK, but I was already very much aware of that incompatibility, so it did not help me solve the problem in any way.

Everybody is still invited to give hints about this. Anything is welcome.

Arnoud
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now