Board index » cppbuilder » BCB dll in VB

BCB dll in VB


2004-06-15 11:02:02 PM
cppbuilder61
Hi Gambit,
Refering to my previous question: 'Using BCB6 Dll in VB'
I have changed my code into:
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#include "TestDll2.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
lpReserved)
{
return 1;
}
extern "C" void __declspec(dllexport) __stdcall TestDll2 (char *file)
{
int i, x, y = 0;
String S;
String Message;
TStringList *TempList = new TStringList();
S = file;
TempList->LoadFromFile(S);
x = TempList->Count;
for (i=0; i<x; i++)
{
y += TempList->Strings[i].Length();
}
Message = "The file";
Message += S;
Message += " has ";
Message += y;
Message += " characters";
MessageDlg(Message, mtInformation,
TMsgDlgButtons() << mbOK,0);
}
If this dll is used in VB, this errormessage is generated:
C:\WINNT\System32\TestDll2.dll was loaded, but the DLL Register Server entry
point was not found.
About VCL:
RTL60.bpl and VCL60.bpl were copied to system32
Thanks,
Jan Vandyck
 
 

Re:BCB dll in VB

"Jan" < XXXX@XXXXX.COM >wrote in message
Quote
#include <windows.h>
You do not need that. The VCL already includes that internally.
Quote
If this dll is used in VB, this errormessage is generated:
It would appear that you are trying to load the DLL into VB as if it were a
COM server. It is not. Please explain, in detail, exactly how you are
trying to load the DLL into VB.
Quote
RTL60.bpl and VCL60.bpl were copied to system32
I suggest you statically link the DLL instead. Then you don't need those
files at all. Go into the Project Options and disable the "Use Dynamic RTL"
and "Build with Runtime Packages" options.
Gambit
 

Re:BCB dll in VB

Quote

It would appear that you are trying to load the DLL into VB as if it were
a
COM server. It is not. Please explain, in detail, exactly how you are
trying to load the DLL into VB.
OK. this is not so easy while I'm sharing parts of my BCB program (or at
least planning to)
with some VB programmers. I 'll try to have this info as soon as I can.
I 'll come back to this.
Quote

>RTL60.bpl and VCL60.bpl were copied to system32

I suggest you statically link the DLL instead. Then you don't need those
files at all. Go into the Project Options and disable the "Use Dynamic
RTL"
and "Build with Runtime Packages" options.

I've allready done this, but disable 'Build with Runtime packages' option
gives me linker errors because I use VCL. (See my question from 11/06/2004)
Thanks for helping me Gambit.
Jan Vandyck
 

{smallsort}

Re:BCB dll in VB

WE WIN!
For your information,
this VBcode works:
Private Declare Function TestDll2 Lib "TestDll2.dll" (ByVal Filename As
String) As Long
Private Sub Form_Load()
Dim retval As Long
retval = TestDll2("c:\autoexec.bat")
End Sub
Thanks again Gambit,
Jan Vandyck