Compiling C++ class project to a dll

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've been given a C++ class library project which I need to use from my
asp.net vb.net project. I have tried building the C++ class library it but it
only creates a series of .obj files which I can't reference from the asp.net
project. How do I get the C++ class library to compile to a dll (I've played
around with the properties of the project but it still doesn't seem to
produce a dll), is there any other way to include it in my asp.net project??
 
To learn more about C++ compiler's option, post your question in the C++
newsgroup.
But if you're not familiar with C++ compiler's option, the easy way to solve
your problem is:
- make an .NET C++ assembly,
- link your assembly with your C++ class library,
- map all methods from your C++ class library in a managed C++ class,
- call your new assembly from your VB.NET project.

For more information see:
http://www.15seconds.com/issue/030729.htm

I hope it helps.

Lionel.
 
jwk said:
I've been given a C++ class library project which I need to use from my
asp.net vb.net project. I have tried building the C++ class library it but
it
only creates a series of .obj files which I can't reference from the
asp.net
project. How do I get the C++ class library to compile to a dll (I've
played
around with the properties of the project but it still doesn't seem to
produce a dll), is there any other way to include it in my asp.net
project??

You need to link them together as a library assembly. From the command line
(for one.obj and two.obj):

link /dll one.obj two.obj

With VS2003 this will give you a warning LNK4243, which in most cases is
harmless, but to compile the DLL properly you will need to create some extra
code as explained here:

http://msdn.microsoft.com/library/d...tsfrompureintermediatelanguagetomixedmode.asp

(this has got to be the web page with the longest name!)

Richard
 
Back
Top