Results 1 to 12 of 12

Thread: DLL Dilema!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91

    Unhappy

    hey, (like the subject line..lol)

    i am having a bit of a problem with using my own DLL's in vb, I wrote it in VC++, and am trying to use it in vb, but i keep getting the error:
    "Cant find DLL entry point in..."

    now do you have any idea why this does that? Do you need to reference it or something? All i am doing to connect it to VB is add:
    Code:
    Private Declare Function add Lib "DLLTest.dll" (y As Integer, x As Integer) As Integer
    in the general declarations, is this wrong? I dunno...

    thanks
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    It all depends on what sort of Dll it is.

    First off though. Is the dll Registered on the system?

    Next if it is an ActiveX or COM dll you should be able to reference the dll as an object, and use the dll like any other object in VB. You can create an instance of it using the CreateObject function, or use the New keyword when declaring it.

    Good Luck.
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91

    thanks...

    erm it is a standard win32 dll made in VC++6, and so doesnt need registering, I have it in the applications folder, and it wont work, pls help me, i am desperate, well sorta! i am bored and want to do this, everytime that i make dlls i cant use them in vb (unless i make them in vb) so what am i doing wrong, i can use the dll in a console C++ app.. ???
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    anyone? please?
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Can you post your C/C++ function prototype, please?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    Here is my simple function:

    Code:
    DLLTEST_API int add(int num1, int num2)
    {
    	return num1+num2;
    }
    and i have declared it in the header as follows:

    Code:
    class DLLTEST_API CDLLTest {
    public:
    	CDLLTest(void);
    	// TODO: add your methods here.
    	DLLTEST_API int add(int num1, int num2);
    };
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    Has anyone else made or used DLL's made in other languages, or made as win32 DLLs? And did you get them to work in vb?
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I use a C++ dll in my VB program with no problem. I know very little about VC++, but I'm going to try and find the source and see if I can tell what the difference is with your code, but don't hold your breath.

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The problem is that your function is inside a class, and consequently does not class (sorry ) as an entry point. If you used:

    Code:
    __declspec(dllexport) int test(int x, int y) {
        return x + y;
    }
    And put the function into your .def file, it should work. VB has difficulty using C++ classes like that.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  10. #10
    Guest
    cant you just add a reference to the file through the project menu and then initiate the class through code, like I do with my VB dll's?

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    THANKS, i am sure it will work now, it is just i dont have a .def file?
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  12. #12
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It's a list of functions in your DLL. It's compiled in when you create it, I think.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width