| Member with 1 posts. THREAD STARTER | | Join Date: Apr 2012 Experience: Beginner | |
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 EndClass 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 |