Discussion:
DLL - entry point
(too old to reply)
Noble Thomas
2004-07-28 05:09:46 UTC
Permalink
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.

To test functioning of DLL's I have created a small project with a function
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".

This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------

Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------

Any help would be appreciated.

If anyone can forward a small project like this to demo dll function, that
would be a great help

rgds

Wilson
Stefan Wuebbe
2004-07-28 06:14:28 UTC
Permalink
Vfp can create custom "COM server DLLs" - they are meant
to be used like this
oMyComServer = CreateObject("Something.ClassName")
oMyComServer.SayHello()
See also the OLEPUBLIC keyword in help.


hth
-Stefan
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a function
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function, that
would be a great help
rgds
Wilson
Sietse Wijnker
2004-07-28 06:31:57 UTC
Permalink
Hi,

DLLs created with VFP are not function libraries as you can create them with
f.i. C++. The dll files in VFP are COM-components (single-or
multi-threaded). This means that when you create a DLL with VFP you'll have
to instanciate an OLEPUBLIC class within that dll to access code within the
library.

FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to create
a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'

Problem you'll find is that COM-components in DLL CAN'T visually interact
with the user. If you want your library to visually interact with the user,
you'll have to compile the secondary project to an EXE or an APP. This gives
you the possibility to have a completely other design because now you can
have a main startup program or form which starts when you activate the app
or exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file

HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a function
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function, that
would be a great help
rgds
Wilson
Wilson Thomas
2004-08-04 07:18:38 UTC
Permalink
Thanks for the info. I have created multiple project like main project with
code, all forms in another project and all reports in a third project. But
it does not work as expected.

E.g., to print a report "emp_list" report, I pass the parameter from the
main program to the report exe, which contain a start up program and all
reports included.

DO allreports.exe WITH "emp_list"

Strat up program in report exe is
------
LPARAMETERS cReportName

IF TYPE('cReportName') = "L"
RETURN
ENDIF

cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.

If this way is not possible, any other alternative

Regards

Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create them with
f.i. C++. The dll files in VFP are COM-components (single-or
multi-threaded). This means that when you create a DLL with VFP you'll have
to instanciate an OLEPUBLIC class within that dll to access code within the
library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to create
a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually interact
with the user. If you want your library to visually interact with the user,
you'll have to compile the secondary project to an EXE or an APP. This gives
you the possibility to have a completely other design because now you can
have a main startup program or form which starts when you activate the app
or exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a
function
Post by Noble Thomas
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function, that
would be a great help
rgds
Wilson
Leonid
2004-08-05 06:52:21 UTC
Permalink
May be

cReportName = ".\reports\" + ALLTRIM(cReportName)+".frx"

will help you?

Leonid
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main project with
code, all forms in another project and all reports in a third project. But
it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from the
main program to the report exe, which contain a start up program and all
reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create them
with
Post by Sietse Wijnker
f.i. C++. The dll files in VFP are COM-components (single-or
multi-threaded). This means that when you create a DLL with VFP you'll
have
Post by Sietse Wijnker
to instanciate an OLEPUBLIC class within that dll to access code within
the
Post by Sietse Wijnker
library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to
create
Post by Sietse Wijnker
a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually interact
with the user. If you want your library to visually interact with the
user,
Post by Sietse Wijnker
you'll have to compile the secondary project to an EXE or an APP. This
gives
Post by Sietse Wijnker
you the possibility to have a completely other design because now you can
have a main startup program or form which starts when you activate the app
or exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes
Post by Wilson Thomas
us
Post by Sietse Wijnker
Post by Noble Thomas
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a
function
Post by Noble Thomas
to display "Hello World" and used the following command to call, but
giver
Post by Sietse Wijnker
Post by Noble Thomas
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function,
that
Post by Sietse Wijnker
Post by Noble Thomas
would be a great help
rgds
Wilson
Wilson Thomas
2004-08-04 07:21:20 UTC
Permalink
Thanks for the info. I have created multiple project like main project with
code, all forms in another project and all reports in a third project. But
it does not work as expected.

E.g., to print a report "emp_list" report, I pass the parameter from the
main program to the report exe, which contain a start up program and all
reports included.

DO allreports.exe WITH "emp_list"

Strat up program in report exe is
------
LPARAMETERS cReportName

IF TYPE('cReportName') = "L"
RETURN
ENDIF

cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.

If this way is not possible, any other alternative

Regards

Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create them with
f.i. C++. The dll files in VFP are COM-components (single-or
multi-threaded). This means that when you create a DLL with VFP you'll have
to instanciate an OLEPUBLIC class within that dll to access code within the
library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to create
a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually interact
with the user. If you want your library to visually interact with the user,
you'll have to compile the secondary project to an EXE or an APP. This gives
you the possibility to have a completely other design because now you can
have a main startup program or form which starts when you activate the app
or exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a
function
Post by Noble Thomas
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function, that
would be a great help
rgds
Wilson
Dan Freeman
2004-08-04 17:22:59 UTC
Permalink
Is it possible your startup directory isn't what you think it is?

After your lparameters line, add WAIT WINDOW CURDIR() to see.

Otherwise, what you've posted here should work.

Dan
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main
project with code, all forms in another project and all reports in a
third project. But it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from
the main program to the report exe, which contain a start up program
and all reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create
them with f.i. C++. The dll files in VFP are COM-components
(single-or multi-threaded). This means that when you create a DLL
with VFP you'll have to instanciate an OLEPUBLIC class within that
dll to access code within the library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to
create a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually
interact with the user. If you want your library to visually
interact with the user, you'll have to compile the secondary project
to an EXE or an APP. This gives you the possibility to have a
completely other design because now you can have a main startup
program or form which starts when you activate the app or exe (do
2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes us hard to send file via email for support. So we have
decided to use DLL projects for easy support.
To test functioning of DLL's I have created a small project with a
function to display "Hello World" and used the following command to
call, but giver error "Cannot fing the entry point SayHello in the
dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll
function, that would be a great help
rgds
Wilson
Wilson Thomas
2004-08-05 05:54:15 UTC
Permalink
My working directory contains a directory called "reports" with all reports.
All these reports are included in the allreports.exe file. Then main.exe and
allreports.exe are copied to a directory "c:\test" (report folder is not
copied since all reports are added to Allreports.exe. Main.exe is working
fine. While allreports is called it says file not found. CURDIR() shows
.\TEST\. I never hardcode full path and reports are called like
.\REPORTS\name

Hope it is clear
Post by Dan Freeman
Is it possible your startup directory isn't what you think it is?
After your lparameters line, add WAIT WINDOW CURDIR() to see.
Otherwise, what you've posted here should work.
Dan
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main
project with code, all forms in another project and all reports in a
third project. But it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from
the main program to the report exe, which contain a start up program
and all reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create
them with f.i. C++. The dll files in VFP are COM-components
(single-or multi-threaded). This means that when you create a DLL
with VFP you'll have to instanciate an OLEPUBLIC class within that
dll to access code within the library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to
create a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually
interact with the user. If you want your library to visually
interact with the user, you'll have to compile the secondary project
to an EXE or an APP. This gives you the possibility to have a
completely other design because now you can have a main startup
program or form which starts when you activate the app or exe (do
2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes us hard to send file via email for support. So we have
decided to use DLL projects for easy support.
To test functioning of DLL's I have created a small project with a
function to display "Hello World" and used the following command to
call, but giver error "Cannot fing the entry point SayHello in the
dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll
function, that would be a great help
rgds
Wilson
Wilson Thomas
2004-08-05 05:56:45 UTC
Permalink
some more info. But when created a folder "reports" under c:\test and copied
all reports, everything is fine. I.e., those files allready added to exe
file are not located by program.

rgds
Post by Wilson Thomas
My working directory contains a directory called "reports" with all reports.
All these reports are included in the allreports.exe file. Then main.exe and
allreports.exe are copied to a directory "c:\test" (report folder is not
copied since all reports are added to Allreports.exe. Main.exe is working
fine. While allreports is called it says file not found. CURDIR() shows
.\TEST\. I never hardcode full path and reports are called like
.\REPORTS\name
Hope it is clear
Post by Dan Freeman
Is it possible your startup directory isn't what you think it is?
After your lparameters line, add WAIT WINDOW CURDIR() to see.
Otherwise, what you've posted here should work.
Dan
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main
project with code, all forms in another project and all reports in a
third project. But it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from
the main program to the report exe, which contain a start up program
and all reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create
them with f.i. C++. The dll files in VFP are COM-components
(single-or multi-threaded). This means that when you create a DLL
with VFP you'll have to instanciate an OLEPUBLIC class within that
dll to access code within the library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here, to
create a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating Automation
Servers'
Problem you'll find is that COM-components in DLL CAN'T visually
interact with the user. If you want your library to visually
interact with the user, you'll have to compile the secondary project
to an EXE or an APP. This gives you the possibility to have a
completely other design because now you can have a main startup
program or form which starts when you activate the app or exe (do
2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes us hard to send file via email for support. So we have
decided to use DLL projects for easy support.
To test functioning of DLL's I have created a small project with a
function to display "Hello World" and used the following command to
call, but giver error "Cannot fing the entry point SayHello in the
dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll
function, that would be a great help
rgds
Wilson
Dan Freeman
2004-08-05 16:24:40 UTC
Permalink
Take the relative path out of your REPORT FORM command. When the report is
built into the EXE, the project manager will resolve pathing issues when the
EXE is built.

Dan
Post by Wilson Thomas
My working directory contains a directory called "reports" with all
reports. All these reports are included in the allreports.exe file.
Then main.exe and allreports.exe are copied to a directory "c:\test"
(report folder is not copied since all reports are added to
Allreports.exe. Main.exe is working fine. While allreports is called
it says file not found. CURDIR() shows .\TEST\. I never hardcode full
path and reports are called like .\REPORTS\name
Hope it is clear
Post by Dan Freeman
Is it possible your startup directory isn't what you think it is?
After your lparameters line, add WAIT WINDOW CURDIR() to see.
Otherwise, what you've posted here should work.
Dan
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main
project with code, all forms in another project and all reports in a
third project. But it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from
the main program to the report exe, which contain a start up program
and all reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create
them with f.i. C++. The dll files in VFP are COM-components
(single-or multi-threaded). This means that when you create a DLL
with VFP you'll have to instanciate an OLEPUBLIC class within that
dll to access code within the library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here,
to create a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating
Automation Servers'
Problem you'll find is that COM-components in DLL CAN'T visually
interact with the user. If you want your library to visually
interact with the user, you'll have to compile the secondary
project to an EXE or an APP. This gives you the possibility to
have a completely other design because now you can have a main
startup program or form which starts when you activate the app or
exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes us hard to send file via email for support. So we have
decided to use DLL projects for easy support.
To test functioning of DLL's I have created a small project with a
function to display "Hello World" and used the following command
to call, but giver error "Cannot fing the entry point SayHello in
the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll
function, that would be a great help
rgds
Wilson
Wilson Thomas
2004-08-06 02:23:01 UTC
Permalink
I tried without path. Also added reports to the root path. Still cannot
locate the file

Any other ideas?
Post by Dan Freeman
Take the relative path out of your REPORT FORM command. When the report is
built into the EXE, the project manager will resolve pathing issues when the
EXE is built.
Dan
Post by Wilson Thomas
My working directory contains a directory called "reports" with all
reports. All these reports are included in the allreports.exe file.
Then main.exe and allreports.exe are copied to a directory "c:\test"
(report folder is not copied since all reports are added to
Allreports.exe. Main.exe is working fine. While allreports is called
it says file not found. CURDIR() shows .\TEST\. I never hardcode full
path and reports are called like .\REPORTS\name
Hope it is clear
Post by Dan Freeman
Is it possible your startup directory isn't what you think it is?
After your lparameters line, add WAIT WINDOW CURDIR() to see.
Otherwise, what you've posted here should work.
Dan
Post by Wilson Thomas
Thanks for the info. I have created multiple project like main
project with code, all forms in another project and all reports in a
third project. But it does not work as expected.
E.g., to print a report "emp_list" report, I pass the parameter from
the main program to the report exe, which contain a start up program
and all reports included.
DO allreports.exe WITH "emp_list"
Strat up program in report exe is
------
LPARAMETERS cReportName
IF TYPE('cReportName') = "L"
RETURN
ENDIF
cReportName = ".\reports\" + ALLTRIM(cReportName)
REPORT FORM &cReportName PREVIEW
--------
Any help would be appreciated.
If this way is not possible, any other alternative
Regards
Wilson
Post by Sietse Wijnker
Hi,
DLLs created with VFP are not function libraries as you can create
them with f.i. C++. The dll files in VFP are COM-components
(single-or multi-threaded). This means that when you create a DLL
with VFP you'll have to instanciate an OLEPUBLIC class within that
dll to access code within the library.
FI
DEFINE CLASS SayHello AS Custom OLEPUBLIC
PROCEDURE SayHello(cString)
STRTOFILE(cString, "log.txt")
ENDPROC
ENDDEFINE
Save the following code to SayHello.prg and compile the dll using
BUILD PROJECT SayHello FROM SayHello.prg
BUILD DLL SayHello.dll FROM SayHello
in the command window (BTW. I'm using a single threaded dll here,
to create a multithreaded dll use BUILD MTDLL)
There's a good piece of info in the VFP help on 'Creating
Automation Servers'
Problem you'll find is that COM-components in DLL CAN'T visually
interact with the user. If you want your library to visually
interact with the user, you'll have to compile the secondary
project to an EXE or an APP. This gives you the possibility to
have a completely other design because now you can have a main
startup program or form which starts when you activate the app or
exe (do 2ndappfile.exe)
You can also use SET CLASSLIB to refer to a classlib in the other app-file
HTH,
Sietse Wijnker
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which
makes us hard to send file via email for support. So we have
decided to use DLL projects for easy support.
To test functioning of DLL's I have created a small project with a
function to display "Hello World" and used the following command
to call, but giver error "Cannot fing the entry point SayHello in
the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll
function, that would be a great help
rgds
Wilson
Devapriya De Silva
2004-07-29 08:54:39 UTC
Permalink
Wilson,

Another thing to add to DLL's in VFP is that it will not support
messageboxes or any user interfaces.

Regards,
Devapriya De Silva
Post by Noble Thomas
I am using VFP 6. My EXE file is getting bigger and bigger, which makes us
hard to send file via email for support. So we have decided to use DLL
projects for easy support.
To test functioning of DLL's I have created a small project with a function
to display "Hello World" and used the following command to call, but giver
error "Cannot fing the entry point SayHello in the dll".
This is the program
-----------
SayHello() && Calling the function
FUNCTION SayHello
=MESSAGEBOX("Hello World 123")
ENDFUNC
-----------
Command issued is
--------------
declare SayHello in test1.dll
?sayHello() **** gives error *****
---------------
Any help would be appreciated.
If anyone can forward a small project like this to demo dll function, that
would be a great help
rgds
Wilson
Loading...