Creating a LIB or DLL

User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Enrico,

Thanks for the advice, I made sure the bcc32.cfg and ilink32.cfg were set up and it works great.

Thnaks again
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

I copied the newly created harbor.exe's to my harbour folder and verified I have current results.

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

I understand that you mean that with the new created Harbour you keep having the exception, right ?

Have you rebuilt the DLL and the EXE with the new created Harbour ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

Correct, I still have the exception.

I have not added any traces to the VMinit to look deeper.

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

Ok, now in Harbour\source\vm\hvm.c function hb_vmInit() please place some traces and rebuild Harbour again and rebuild the DLL and the EXE:

Code: Select all

...

#include <windows.h>  // new !!! 

void hb_vmInit( BOOL bStartMainProc )
{
   HB_TRACE(HB_TR_DEBUG, ("hb_vmInit()"));

   MessageBox( 0, "before hb_xinit()", "ok", 0 );   // New !!!
   hb_xinit();
   MessageBox( 0, "after hb_xinit()", "ok", 0 );   // New !!!

   MessageBox( 0, "before hb_vmSetExceptionHandler()", "ok", 0 );   // New !!!
   hb_vmSetExceptionHandler();
   MessageBox( 0, "after hb_vmSetExceptionHandler()", "ok", 0 );   // New !!!

   MessageBox( 0, "before hb_vmSymbolInit_RT()", "ok", 0 );   // New !!!
   hb_vmSymbolInit_RT();      /* initialize symbol table with runtime support functions */
   MessageBox( 0, "after hb_vmSymbolInit_RT()", "ok", 0 );   // New !!!

   MessageBox( 0, "before hb_stackInit()", "ok", 0 );   // New !!!
   hb_stackInit();                        /* initialize HVM stack */
   MessageBox( 0, "after hb_stackInit()", "ok", 0 );   // New !!!

   ...
 
and so on, so we can detect where the exception is coming from.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

I keep getting compile error

Error: Unresolved external '_MessageBox' referenced from C:\HS\HARBOUR\LIB\WIN\BCC\HBVM.LIB|hvm

also this is how the initstack is.

Code: Select all

#if defined( HB_MT_VM )
   hb_threadInit();
   hb_vmStackInit( hb_threadStateNew() ); /* initialize HVM thread stack */
   s_pSymbolsMtx = hb_threadMutexCreate( FALSE );
#else
   hb_stackInit();                        /* initialize HVM stack */
#endif
 

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

> Error: Unresolved external '_MessageBox' referenced from C:\HS\HARBOUR\LIB\WIN\BCC\HBVM.LIB|hvm

Do you get that error when building your DLL ? Or when you rebuild Harbour ?

Have you included #include <windows.h> inside hvm.c as I shown you ?

> also this is how the initstack is.
> #if defined( HB_MT_VM )

That define is for multithreading and we are not going to use it for now, thats why you can place the trace in the #else section.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

Yes, I forgot the #include <windows.h> inside hvm.c
I put it in there and still having some sort of problems.

When I added the messages in the HVM I was still not hitting them

To be sure I started over fresh with no changes

I noticed this in my log

-+thread.obj &
-+vm.obj &
-+harbinit.obj &
-+
Warning: 'hvm' not found in library
Warning: 'arrays' not found in library
Warning: 'arrayshb' not found in library
Warning: 'asort' not found in library
Warning: 'break' not found in library
Warning: 'classes' not found in library
Warning: 'cmdarg' not found in library
Warning: 'debug' not found in library
Warning: 'dynlibhb' not found in library
Warning: 'dynsym' not found in library
Warning: 'codebloc' not found in library
Warning: 'estack' not found in library
Warning: 'eval' not found in library
Warning: 'evalhb' not found in library
Warning: 'extend' not found in library
Warning: 'extrap' not found in library
Warning: 'fm' not found in library
Warning: 'garbage' not found in library
Warning: 'hashes' not found in library
Warning: 'hashfunc' not found in library
Warning: 'initexit' not found in library
Warning: 'initsymb' not found in library
Warning: 'itemapi' not found in library
Warning: 'macro' not found in library
Warning: 'mainstd' not found in library
Warning: 'mainwin' not found in library
Warning: 'memvars' not found in library
Warning: 'memvclip' not found in library
Warning: 'pcount' not found in library
Warning: 'proc' not found in library
Warning: 'pvalue' not found in library
Warning: 'runner' not found in library
Warning: 'set' not found in library
Warning: 'thread' not found in library
Warning: 'vm' not found in library
Warning: 'harbinit' not found in library
mingw32-make.exe[3]: Leaving directory `C:/hs/harbour/source/vm/win/bcc'
mingw32-make.exe -C mainstd
mingw32-make.exe[3]: Entering directory `C:/hs/harbour/source/vm/mainstd'


I am still creating a harbour.exe

Any ideas?
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

I have copied .bat .mak and .sh files
from my \harbour-1.0.1\contrib folder to my c:\hs\harbour folder



My make_b32.bat

Code: Select all

@echo off
rem
rem $Id: make_b32.bat 7995 2007-11-19 14:13:53Z vszakats $
rem

call mtpl_b32.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

when I run my makeb32.bat I get

MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Fatal: Unable to open makefile

in my make_b32.log. Should I be passing it any parameters?

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

> I am still creating a harbour.exe

If you previously delete harbour.exe and all the Harbour LIBs, do they get built again ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

Maybe some progress.

I copied files from \harboursource\harbour-1.0.1\

to my \hs\harbour folder

now when I run makeb32.bat I get:


MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
Borland C++ 5.5 for Win32 Copyright (c) 1993, 2000 Borland
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_hb_snprintf' referenced from C:\HS\HARBOUR\LIB\B32\HBCOMMON.LIB|hbver

** error 1 ** deleting bin\b32\hbpp.exe


No EXE's created

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

I just followed Enrico's instructions and Harbour EXEs and LIBs were properly built on first try:

1. I did a checkout on a clean directory as I explained you in this thread.

2. I created a makeb32.bat in the same path where make_gnu.bat is with these contents:

Code: Select all

@ ECHO OFF
SET PATH=c:\bcc55\bin;c:\mingw\bin;%PATH%
SET HB_COMPILER=bcc
SET HB_USER_CFLAGS=-DHB_FM_STATISTICS_OFF
make_gnu clean install > make_gnu.log 2>&1
 
3. I run makeb32.bat and got everything properly built :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

I have separated my makegnu.bat from my other makeb32.bat in my hs folder and have
put it in my hs1 folder. It does build for me too. I am going to start over with makeb32.bat in a fresh
folder.


My current makegnu.bat

Code: Select all

del \hs1\harbour\bin\*.exe
del \harbour\*.exe
SET PATH=c:\bcc55\bin
SET HB_COMPILER=bcc
SET HB_USER_CFLAGS=-DHB_FM_STATISTICS_OFF
make_gnu clean install > make_gnu.log 2>&1
copy \hs1\harbour\bin\*.exe \harbour\bin\
 


Here is what I have in the hvm.c file.

Code: Select all


/* application entry point */

#include <windows.h>  // new !!!

void hb_vmInit( BOOL bStartMainProc )
{
   HB_TRACE(HB_TR_DEBUG, ("hb_vmInit()"));

   MessageBox( 0, "before hb_xinit()", "ok", 0 );   // New !!!
   hb_xinit();
   MessageBox( 0, "after hb_xinit()", "ok", 0 );   // New !!!
   
   hb_vmSetExceptionHandler();

   hb_vmSymbolInit_RT();      /* initialize symbol table with runtime 

support functions */

#if defined( HB_MT_VM )
   hb_threadInit();
   hb_vmStackInit( hb_threadStateNew() ); /* initialize HVM thread stack 

*/
   s_pSymbolsMtx = hb_threadMutexCreate( FALSE );
#else
   hb_stackInit();                        /* initialize HVM stack */
#endif
 
I see a lot of this in my make_gnu.log.

Code: Select all

-+genhrb.obj & 
-+hbcmplib.obj & 
-+hbcomp.obj & 
-+hbdbginf.obj & 
-+hbfunchk.obj & 
-+hbgenerr.obj & 
-+hbpcode.obj & 
-+hbfix.obj & 
-+hbdead.obj & 
-+hblbl.obj & 
-+hbopt.obj & 
-+hbstripl.obj & 
-+hbusage.obj & 
-+hbident.obj & 
-+ppcomp.obj & 
-+expropta.obj & 
-+exproptb.obj & 
-+complex.obj & 
-+compi18n.obj & 
-+hbmain.obj & 
-+
Warning: 'harboury' not found in library
Warning: 'cmdcheck' not found in library
Warning: 'genc' not found in library
Warning: 'gencc' not found in library
Warning: 'gencobj' not found in library
Warning: 'genhrb' not found in library
Warning: 'hbcmplib' not found in library
Warning: 'hbcomp' not found in library
Warning: 'hbdbginf' not found in library
Warning: 'hbfunchk' not found in library
Warning: 'hbgenerr' not found in library
Warning: 'hbpcode' not found in library
Warning: 'hbfix' not found in library
Warning: 'hbdead' not found in library
Warning: 'hblbl' not found in library
Warning: 'hbopt' not found in library
Warning: 'hbstripl' not found in library
Warning: 'hbusage' not found in library
Warning: 'hbident' not found in library
Warning: 'ppcomp' not found in library
Warning: 'expropta' not found in library
Warning: 'exproptb' not found in library
Warning: 'complex' not found in library
Warning: 'compi18n' not found in library
Warning: 'hbmain' not found in library
 

I cannot seem to hit the messagebox in the VMinit()

I still get the exception before I hit the new before vminit messagebox


Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Creating a LIB or DLL

Post by Antonio Linares »

Dave,

But you said that you: "Made it to before VMinit"

Has that changed ?

What MessageBox prompt do you see before the exception ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Dave Zowasky
Posts: 125
Joined: Wed Oct 19, 2005 2:28 pm
Location: Hudson Ohio
Contact:

Re: Creating a LIB or DLL

Post by Dave Zowasky »

Antonio,

I am able to get the before vminit in the maindll.c not the one before in the hvm.c

Thanks
Dave Zowasky
Com1 Software, Inc.
http://www.com1software.com
information@com1software.com
330 653-3771
Post Reply