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

Use *.lib as reference

RF
Hi All,

How can I use the *.lib as a reference in a C# solution. Whenever I try to
add a "lib" file, VS throws an error explaining it must have a dll
extension?

Can anyone help?

Thankx,

RF
Nov 16 '05 #1
3 4332
No, only .Net assemblies (DLL's) and COM DLLs can be referenced in a C#
project.

I think the only thing you could do here is to write a managed C++ class
libary wrapper around the .lib file and then reference the managed C++
assembly.

Adam Clauss
ca*****@tamu.edu

"RF" <ra*******@SPAMdialexia.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi All,

How can I use the *.lib as a reference in a C# solution. Whenever I try to
add a "lib" file, VS throws an error explaining it must have a dll
extension?

Can anyone help?

Thankx,

RF

Nov 16 '05 #2
Hi RF,

"RF" <ra*******@SPAMdialexia.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi All,

How can I use the *.lib as a reference in a C# solution. Whenever I try to
add a "lib" file, VS throws an error explaining it must have a dll
extension?

You *cannot* add references to static unmanaged/native libraries.
"Add reference..." is to add a [reference] to other .NET assemblies,
that resides in dynamic libraries.

If you want to use the content of a static library, I would advice you
to make a small wrapper project in C++, link with the library, expose
the needed functions (with a .def-file or alike), compile the whole lot
with the /clr compiler switch (Use Managed Extentions), and add a
reference to it.

--
Lars Wilhelmsen
http://www.sral.org/
Software Engineer
Teleplan A/S, Norway
Nov 16 '05 #3
Just to add to the other answers:

I assume that the .lib that you are looking to reference is something that
you inherited... OTOH, if it is a standard library, then there's probably
already a call in the .NET framework that replaces it.

Good Luck,
--- Nick

"RF" <ra*******@SPAMdialexia.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi All,

How can I use the *.lib as a reference in a C# solution. Whenever I try to
add a "lib" file, VS throws an error explaining it must have a dll
extension?

Can anyone help?

Thankx,

RF

Nov 16 '05 #4

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

Similar topics

2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
11
by: Doug | last post by:
Is there any harm in passing an object into a method with the 'ref' keyword if the object is already a reference variable? If not, is there any benefit?
13
by: Abe Frohnman | last post by:
Hello all, I'm passing a reference to a class into the constructor of a form, like so: public MyForm(int count, ref Area myArea) {...} How can I use myArea outside the constructor? Should I...
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
13
by: al.cpwn | last post by:
I get that these two are different int* get() { static int m; return &m; } int& get() {
51
by: Kuku | last post by:
What is the difference between a reference and a pointer?
27
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
41
by: Summercool | last post by:
Can we confirm the following? also someone said, Java also has "reference" like in C++, which is an "implicit pointer": Pointer and Reference --------------------- I am starting to see what...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.