Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Search Search
Search for:
Tech Support Guy > > >

Problem developping simple dll in vc++ 2008 express


(!)

newdev's Avatar
newdev newdev is offline
Computer Specs
Member with 1 posts.
THREAD STARTER
 
Join Date: Apr 2012
Experience: Beginner
30-Apr-2012, 07:16 AM #1
Unhappy Problem developping simple dll in vc++ 2008 express
I've developped a very simple dll and all seems to be ok at compilation time but I'm not able to use the exported function on VB project.
Here the code:
MyDll.h:
#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif
// Questa classe esportata da MyDll.dll
class MYDLL_API CMyDll {
public:
CMyDll(void);
// TODO: aggiungere qui i metodi.
};
extern MYDLL_API int nMyDll;
MYDLL_API int fnMyDll(void);
MYDLL_API int fnCubeByVal(int);
MYDLL_API void fnCubeByRef(int *);

MyDll.cpp:
#include"stdafx.h"
#include"MyDll.h"

// Esempio di variabile esportata
MYDLL_API int nMyDll=0;
// Esempio di funzione esportata.
MYDLL_API int fnMyDll(void)
{
return 42;
}
MYDLL_API int fnCubeByVal(int data){
return data * data * data;
}
MYDLL_API void fnCubeByRef(int *data){
*data = *data * *data * *data;
}
// Costruttore di una classe esportata.
// Vedere MyDll.h per la definizione della classe
CMyDll::CMyDll()
{
return;
}

and here the simple code in vb:
PublicClass Form1
PrivateDeclareFunction fnCubeByVal Lib"MyDll.dll" (ByVal data AsInteger) AsInteger
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = fnCubeByVal(5)
EndSub
End
Class

When I debuc the project I get the following error message:
Eccezione first-chance di tipo 'System.EntryPointNotFoundException' in TestMyDll.exe

Can someone help me?
Thanks a lot!

Tech Support Guy System Info Utility version 1.0.0.2
OS Version: Microsoft Windows 7 Home Premium, Service Pack 1, 32 bit
Processor: Intel(R) Core(TM)2 Duo CPU P7450 @ 2.13GHz, x64 Family 6 Model 23 Stepping 6
Processor Count: 2
RAM: 3066 Mb
Graphics Card: NVIDIA GeForce G 105M, 512 Mb
Hard Drives: C: Total - 466937 MB, Free - 146651 MB;
Motherboard: Acer, JV50
Antivirus: Norton Internet Security, Updated and Enabled
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑