0

Hi,

I am trying to make and use my own DLL within a C++/CLI project.

The DLL project contains an header utc.h file with the following declaration:

namespace utc
 {
      __declspec(dllexport) void dthr (int dt[3], int hr[3]);
 }

The source of the dthr.cpp file starts with:

namespace utc
{
__declspec(dllexport) void dthr (int dt[3], int hr[3])
   {
   }
}

The build of the utc.dll file is successful.

Within a Forms C++/CLI project, I have a WriteToLog.cpp file that starts with:

#include "stdafx.h"
#include "utc.h"

using namespace utc;

void WriteToLog(String ^mess)
{
  int dt[3], hr[3];

  dthr(dt, hr);

WriteToLog compiles fine. Using the "Properties -> Framework and references" dialog, I have added utc.dll as a reference.

But the linker does not find dthr().

What am I missing?

As a side question, it seems that I cannot use a static C++ .lib file with a C++/CLI application: the add Reference dialog does not support .lib files.

Is there another way to use a .lib file? I would prefer that to using a DLL.

Thanks.

3
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by Excizted
0

Edit: I found out how to use .lib static libraries.

0

Static libraries are not DLL's.

DLL's are Dynamic Libraries, which is more the opposite of static libraries.

So if you're linking a static library, and then thinking "woot now it's collecting data from my DLL", then you're wrong. Try deleting the DLL, your program won't complain that it is missing a DLL :)

Just fyi.

0

So if you're linking a static library, and then thinking "woot now it's collecting data from my DLL", then you're wrong. Try deleting the DLL, your program won't complain that it is missing a DLL :)

No, I wasn't doing that. I was linking a DLL by referencing it, but members of the DLL are not found, I end up with build errors.

0

You have to include the library, which is also output when you build DLL.
That library isn't a static library, but it just tells your project what content there is in the DLL.

0

You have to include the library, which is also output when you build DLL.
That library isn't a static library, but it just tells your project what content there is in the DLL.

Aaah!

Thanks, I would never had guessed that I needed to reference the .DLL file first, and then to include the .lib file.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.