473,400 Members | 2,163 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,400 software developers and data experts.

calling a DLL, using MS VC++

Hi,

I'm trying to call a DLL that I created using Microsoft Visual C++, and
ascertain that I created the DLL properly. I've never created a DLL
before, and the Microsoft documentation does not help me:
http://msdn.microsoft.com/library/de...attributes.asp
Also, if possible, I want to avoid using the Visual C++ wizard to create
a DLL, because that creates several files and extra lines of code.

Below is my test code. The first file creates a DLL with the function
"printHello()". The second file, the "main" program, tries to call that
function in the DLL. I believe the main program *could* find the DLL,
and that there is merely something wrong with my C++ syntax: I
remembered to put the DLL into the directory where the executable for
the main program was to be created, and set the PATH variable to search
the current "." directory.

** What is causing my DLL link error?

Thanks,
Suzanne

------------------------------------------
#include <stdlib.h>
#include <iostream>

__declspec(dllexport) println(char* s);

__declspec(dllexport) void printHello() {
std::cout << "Hello world\n";
}
------------------------------------------
#include <stdlib.h>

__declspec(dllimport) void printHello();

int main(int argc, char** argv) {
void (*f)() = &printHello;
f(); // Link error!!!

return EXIT_SUCCESS;
}

Jul 19 '05 #1
2 4668
"Suzanne Vogel" <su*************@hotmail.com> wrote...
I'm trying to call a DLL that I created using Microsoft Visual C++, and
ascertain that I created the DLL properly. [..]


It's not your first day here, is it? Don't you already know
that MS-specific questions are off-topic here? Please visit
microsoft.public.vc.language.
Jul 19 '05 #2
> It's not your first day here, is it? Don't you already know
that MS-specific questions are off-topic here? Please visit
microsoft.public.vc.language.


Got it. Sorry.

Jul 19 '05 #3

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

Similar topics

1
by: Jamell | last post by:
I was wondering if anyone knows how to access a control (like a textbox control) that is attached to a MS Word document. I need to do it using VC++.NET. Any example would be a big help.
3
by: Jason Heyes | last post by:
How can I define the member function of this template class using VC++ 6.0? The only way I got it to work was to define the member function inline. template <typename T> class Seq { public:...
1
by: Universal | last post by:
store Images (or any Binary Data) to a SQL Server database using VC++ Can anybody help me in this Thanks in advance
4
by: Anthony Gallagher | last post by:
I have a bunch of libraries compiled using VC++ 6.0, and I am trying to recompile one of our projects using VC++ .NET. I get all kind of linker errors (specially in STL calls). How do I get rid of...
2
by: shama | last post by:
HI all, I am new on .net framework, I am using .net 2005 I want to create add-in for Microsoft office, using VC++ with managed code. When I had made add-in using Extensibility project ->...
0
axtens
by: axtens | last post by:
G'day everyone Recently I used Delphi to wrap libiconv for use in VB6 as a COM object. I'm now using VC++6 to wrap Bill Poser's libuninum and am pretty close to completion. This issue I have...
0
by: Sheoak | last post by:
Hi, I am developing Crystal Reports using VC++.Net Unlike VB.Net in the VC++.Net there is no report objects. How do I change the report's page layout to landscape in the IDE and also...
1
by: KDhanalakshmi | last post by:
Using Vc++ Dll In C# Code Hi I am using VC++ dll in c# application After importing dll, if i try to insert out before string sOut in the following statement, it is throwing error. The...
1
by: Vishal | last post by:
I want to execute sybase query using VC++. Can anyone give me a sample program in VC++? Thanks in advance
0
by: abc xyz | last post by:
I am new to VC++ but have a pretty good knowledge on C++.I am analysing DLL assemblies coded using VC++. But I feel that its syntax is not like our usual C++ code. Does MFC come into picture here. is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.