Results 1 to 9 of 9

Thread: VC++ DLL's

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I forget If I asked this before or not, but I'm having trouble writing a C++ DLL for use in VB...The VB error I'm getting is something like "Cannot find point of entry for DLL" or something like that, it's been a few days since I last tried it...Any help woulld be appreciated...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Guest
    use this style function declaration:

    Code:
    int _stdcall add(int one, int two)
    {
    return one + two;
    }

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    thanks Dennis, I don't need a DEF file or something like that, or do I??
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    still a problem...

    here is the code that VC++ generated, the code I wrote is in bold:

    Code:
    #include "stdafx.h"
    
    float _GetMiddle(float pointA, float pointB);
    
    BOOL APIENTRY DllMain( HANDLE hModule, 
                           DWORD  ul_reason_for_call, 
                           LPVOID lpReserved
    					 )
    {
        return TRUE;
    }
    
    float _GetMiddle(float pointA, float pointB)
    {
    	float result;
    
    	result = (pointA + pointB)/2;
    
    	return result;
    }
    the error I get in VB is : "Can't find entry point GetMiddle in test". test is the name I gave the DLL. I haven't used C++ in a while, and this is the first DLL I'm writing, so try to dumb down your reponse if you like to use techno-babble...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5
    Guest
    Sorry, yes you do need a DEF file.


    Code:
    LIBRARY "test.dll"
    
    EXPORTS
    	add

  6. #6

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Sorry for the ignorance, but How do I tie that in with the project, do you know?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  7. #7
    Guest
    Click on the 'source files' folder, and go to the file menu, and click 'new', then chose 'text file', name the file 'test.def'

    the name doesn't matter much, but just make sure it has a *.def ending.

  8. #8

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    cool, thanks...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    VC++ automatically sends it to the linker if there's one in the project. If you ever need the command line for it, there's docs on MSDN as to how to do it.
    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