1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Problem developping simple dll in vc++ 2008 express

Discussion in 'Software Development' started by newdev, Apr 30, 2012.

Thread Status:
Not open for further replies.
  1. newdev

    newdev Thread Starter

    Apr 29, 2012
    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:
    #ifdef MYDLL_EXPORTS
    #define MYDLL_API __declspec(dllexport)
    #define MYDLL_API __declspec(dllimport)
    // Questa classe esportata da MyDll.dll
    class MYDLL_API CMyDll {
    // 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 *);


    // 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

    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)

    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
    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
As Seen On...

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.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1051398