Article View: comp.windows.ms.programmer
Article #219VB and DLL in Borland C++
From: Florence HAGEN
Date: Wed, 08 Apr 1992 09:14
Date: Wed, 08 Apr 1992 09:14
62 lines
1833 bytes
1833 bytes
Hello,
I am going to try to call a DLL written,compiled and linked with Borland C++ 2.0from Visual Basic.
As I execute the VB program, VB says: Sub or Function not defined.
I work with Windows 3.0.
I tried the same thing with a DLL written, compiled and linked with Microsoft C 6.0 and it was successfull.
What is the problem with Borland?
I don't understand.
Here are the files.
flo.hpp
-------
BOOL FAR PASCAL LibMain(HANDLE,WORD,WORD,LPSTR);
int FAR PASCAL anamain(int);
pilot.cpp
------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <windows.h>
#include "flo.hpp"
int FAR PASCAL LibMain( HANDLE hInstance, WORD wDataSegment,
WORD wHeapSize, LPSTR lpszCmdLine )
{
if ( wHeapSize != 0 )
UnlockData( 0 );
return 1;
}
int far pascal anamain(int i)
{
int j=9;
return (i+j);
}
pilot.def
---------
LIBRARY pilot
DESCRIPTION 'ESSAI DLL en Borland C++2.0 FH-NM.31.03.92'
EXETYPE WINDOWS
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 1024
EXPORTS anamain
Here is the VB code in the global module:
Declare Function anamain Lib "c:\mks\flo\dll\pilot.dll" (Byval s1%) as Integer
And here the call of the function:
s1%=Val(Readin.Txt)
res%=anamain(s1%)
Readout.Txt=Str$(res%)
Could somebody help me?
My mailing address is : hagen@lesosun1.epfl.ch or hagen@sicsun.epfl.ch
Thank you.
FH.
Technical Details
Message-ID:
<2751@sicsun.epfl.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!hagenShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!hagen From: hagen@sicsun.epfl.ch (Florence HAGEN) Newsgroups: comp.windows.ms.programmer Subject: VB and DLL in Borland C++ Message-ID: <2751@sicsun.epfl.ch> Date: 8 Apr 92 09:14:01 GMT Organization: Ecole Polytechnique Federale de Lausanne, Suisse Lines: 62