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

A simple DLL project

I would like learn how to use VC++ 6.0 Stantard edition to
build a DLL. I used the VC++ option "A DLL that exports
some symbols" to generate a complete project for me. The
following is the source file, int fnTest(void) will be
exported.

// test.cpp : Defines the entry point for the DLL
application.
//

#include "stdafx.h"
#include "test.h"

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported variable
__declspec( dllexport ) int nTest=0;

// This is an example of an exported function.
__declspec( dllexport ) int fnTest(void)
{
return 42;
}

// This is the constructor of a class that has been
exported.
// see test.h for the class definition
CTest::CTest()
{
return;
}

I have not change anything and build a dll.

However when I try to use VB6 to call this dll function by
using the following VB code

Declare Function fnTest Lib "test" () As Integer

Sub callaDLL()
Dim x As Integer
x = fnTest()
End Sub

The following error message pop up after callaDLL run.
runtime error '453'
Can't find DLL entry point fnTest in test

I know that thet function name is case sensitive and has
been checked.

Please help the beginner.

Thanks

Enoch
Nov 20 '05 #1
2 2636
Hi there,

It would seem that you've wandered into the wrong room. We all do VB here
and (mostly) quake in our boots when faced with C++. ;-)

There's a better room to go to somewhere down the hall, as it were. One of
the guys will tell you which it is in the morning.

DF
Nov 20 '05 #2
"Enoch Chan" <en********@masons.com> scripsit:
I would like learn how to use VC++ 6.0 Stantard edition to
build a DLL. I used the VC++ option "A DLL that exports
some symbols" to generate a complete project for me. The
following is the source file, int fnTest(void) will be
exported.


You will find a working sample here:

<http://www.ahs-bruck.asn-graz.ac.at/~hwagner/newsgroup/sort32.zip>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

3
by: Ryno Rijnsburger | last post by:
I am busy packaging our product as a standard Setup project in VS.NET that uses a bunch of merge modules (basically, a merge module for every key infrastructure component in our system). Part...
0
by: Bonj | last post by:
I'm mainly experienced in VB6, haven't really got to grips with .NET very much. I'd like to create, more as a practice project than anything, a simple ASP.NET web application that will just do...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
6
by: academic | last post by:
I want to compile a simple c program. Not c++ Not even Windows. Just a simple program to run in a DOS window. In vs2005 what type of project to I use. I can't get started. I tried a couple...
1
by: beachboy | last post by:
My project has many class (function), it need to create a new instance each time by the id value, how can i write a code as much simple? Actually, all cases is doing the same thing.... , but is...
4
by: Chris | last post by:
Hi this time I am interested in console applications only. Now I need to create a simple .dll. How to do that? I am totally newbie in dll creation so be patient ;) I have searched internet but I...
0
by: Kevin Burton | last post by:
Thist is probably very simple for many of you but I am just catching on that a major change has taken place in the way web projects work and I cannot get it to work so please indulge me. First,...
1
by: laurent4x4x | last post by:
Hi all , just a simple fact : i know java and i know a little bit of C, not good at all in C++ or .Net framework I got a simple sdk (about indexing ) an old one from 1998, in plain C no C++...
2
by: Bhasker V Kode | last post by:
Hi, I just wanted to share with everyone a new project that i'm launching today called the Returnable Project ( http://returnable.org ) Returnable serves as a open-platform architectural guide...
1
by: Anonymous | last post by:
I have a Win32 DLL project that needs to be refactored to support ATL. Specifically, I need to expose one COM object, that makes use of the library functionality. I tried adding a 'Simple ATL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.