Linking to library as opposed to DLL? 
Author Message
 Linking to library as opposed to DLL?

Is it possible to static link to an external library or object file with
VB5 or is the use of DLL the only way to refer to foreign procedures?
I'd like to call a fortran computational module but would rather
distribute a single executable file if possible.

I've been told it can't be done, but....



Sat, 11 Sep 2004 04:10:35 GMT  
 Linking to library as opposed to DLL?
I'm not sure whether a VB Resource File is large enough to accommodate your
DLL, but if not you could always "tack it on to the end" of your exe file
and then your VB app could "read it from the end of the VB exe file" and
save the DLL data as a separate file using standard VB file I/O stuff and
then load it back and dump it into the user's System directory. I don't know
whether that would work, but its certainly worth a try. If you have a
problem reading your own exe file because it is "open" (as you may do on
some systems, I believe) then there are alternatives that I can think of -
perhaps storing your DLL file as the data portion of a "picture" property of
an Image control. You could then write the picture property to disk and get
the appropriate part of it back from there. I'm drunk at the moment, so
maybe this stuff isn't even possible - but its definitely worth looking at
;-)

Mike


Quote:
> Is it possible to static link to an external library or object file with
> VB5 or is the use of DLL the only way to refer to foreign procedures?
> I'd like to call a Fortran computational module but would rather
> distribute a single executable file if possible.

> I've been told it can't be done, but....



Sat, 11 Sep 2004 04:29:42 GMT  
 Linking to library as opposed to DLL?
OK, thanks, Mike...if I were to do that, I might just as well package
the executable and dll together as a zipped executable and just
uncompress the dll as well.  I was <hoping> there was a way to spoof the
link process and actually link statically....but I'm much more familiar
w/Fortran than VB...
Quote:

> I'm not sure whether a VB Resource File is large enough to accommodate your
> DLL, but if not you could always "tack it on to the end" of your exe file
> and then your VB app could "read it from the end of the VB exe file" and
> save the DLL data as a separate file using standard VB file I/O stuff and
> then load it back and dump it into the user's System directory. I don't know
> whether that would work, but its certainly worth a try. If you have a
> problem reading your own exe file because it is "open" (as you may do on
> some systems, I believe) then there are alternatives that I can think of -
> perhaps storing your DLL file as the data portion of a "picture" property of
> an Image control. You could then write the picture property to disk and get
> the appropriate part of it back from there. I'm drunk at the moment, so
> maybe this stuff isn't even possible - but its definitely worth looking at
> ;-)

> Mike



> > Is it possible to static link to an external library or object file with
> > VB5 or is the use of DLL the only way to refer to foreign procedures?
> > I'd like to call a Fortran computational module but would rather
> > distribute a single executable file if possible.

> > I've been told it can't be done, but....



Sat, 11 Sep 2004 04:45:47 GMT  
 Linking to library as opposed to DLL?
I was recently informed of this little dream-come-true:
http://devx.com/premier/mgznarch/vbpj/1999/11nov99/jc1199/jc1199.asp
Hope you're ready for it!  :)


Quote:
> Is it possible to static link to an external library or object file with
> VB5 or is the use of DLL the only way to refer to foreign procedures?
> I'd like to call a Fortran computational module but would rather
> distribute a single executable file if possible.

> I've been told it can't be done, but....



Sat, 11 Sep 2004 08:23:13 GMT  
 Linking to library as opposed to DLL?

Quote:

> I was recently informed of this little dream-come-true:
> http://devx.com/premier/mgznarch/vbpj/1999/11nov99/jc1199/jc1199.asp
> Hope you're ready for it!  :)



> > Is it possible to static link to an external library or object file with
> > VB5 or is the use of DLL the only way to refer to foreign procedures?
> > I'd like to call a Fortran computational module but would rather
> > distribute a single executable file if possible.

> > I've been told it can't be done, but....

Oh, Yeah, Doug!!!  I had looked at that just a week or so ago and
already forgotten it!  Guess that shows something about my age. :(
Anyway, I wasn't sure I wanted to quite that badly....maybe a cold
winter's evening project when I'm not trying to actually finish a
project.....

But thanks, I did bookmark it this time....



Sat, 11 Sep 2004 11:55:00 GMT  
 Linking to library as opposed to DLL?
A cold winter's evening indeed!  I want to be able to control the
conditional compilation arguments from the command line, but understanding
that stuff is gonna be lots of fun.  This seems to be the *only* way to do
it though (same for you too) as far as I can tell.  Of course there's also
the question of whether or not to use it in a real project in the first
place, considering it's all unsupported...


Quote:


> > I was recently informed of this little dream-come-true:
> > http://devx.com/premier/mgznarch/vbpj/1999/11nov99/jc1199/jc1199.asp
> > Hope you're ready for it!  :)



> > > Is it possible to static link to an external library or object file
with
> > > VB5 or is the use of DLL the only way to refer to foreign procedures?
> > > I'd like to call a Fortran computational module but would rather
> > > distribute a single executable file if possible.

> > > I've been told it can't be done, but....

> Oh, Yeah, Doug!!!  I had looked at that just a week or so ago and
> already forgotten it!  Guess that shows something about my age.
> Anyway, I wasn't sure I wanted to quite that badly....maybe a cold
> winter's evening project when I'm not trying to actually finish a
> project.....

> But thanks, I did bookmark it this time....



Sat, 11 Sep 2004 19:55:33 GMT  
 Linking to library as opposed to DLL?

Quote:
> A cold winter's evening indeed!  I want to be able to control the
> conditional compilation arguments from the command line,

I think you'll find this is not going to work. VB does a fair amount of
pre-compiling before calling the external compiler, and there's no way to
intercept what's happening inside vb6.exe during the compile process.

If you want to control the conditional-compile args on a per-build basis,
there are build tools with that functionality built in. (All they do is
create a temp VBP file, set the args correctly in that file, then pass file
that to vb6.exe to build the binary.)

If you want to have different settings for your conditional compile args
that vary between design-time and compile-time, then an add-in called
vbAdvance will do that for you, as well as quite a few other "impossible"
things in VB.
www.vbadvance.com

-Pete



Tue, 14 Sep 2004 00:41:28 GMT  
 Linking to library as opposed to DLL?

Quote:
> I'd like to call a Fortran computational module but would rather
> distribute a single executable file if possible.

Well, unless you can guarantee the VB runtimes are installed on every target
machine, you'll have to distribute those as well. I would recommend you use
a good install package, such as Inno Setup, which can produce a single,
self-extracting EXE. (And it's free!)
http://www.jrsoftware.org/isinfo.php

HTH,

Pete



Tue, 14 Sep 2004 00:48:59 GMT  
 Linking to library as opposed to DLL?
That I can do as it goes to a <very> limited number of machines....it's
just that the engineers at the plant don't always follow instructions
and I've had more trouble with finding the DLL at run time because it
didn't get put where wanted.  

These are not commercial apps by any stretch, they're for OOAK (one of a
kind) engineering studies at power plants for post-processing data
collected during a set of tests...

So, mayhaps your suggestion is a good one, anyway, as it would then
allow them to go to any other machine which has access to the data
files....

Quote:

> > I'd like to call a Fortran computational module but would rather
> > distribute a single executable file if possible.

> Well, unless you can guarantee the VB runtimes are installed on every target
> machine, you'll have to distribute those as well. I would recommend you use
> a good install package, such as Inno Setup, which can produce a single,
> self-extracting EXE. (And it's free!)
> http://www.jrsoftware.org/isinfo.php

> HTH,

> Pete



Tue, 14 Sep 2004 03:31:13 GMT  
 Linking to library as opposed to DLL?
I was afraid of this.  I might just do something like the temporary vbp file
thing.  I dunno...

The vbadvance stuff looks interesting though.


Quote:
> > A cold winter's evening indeed!  I want to be able to control the
> > conditional compilation arguments from the command line,

> I think you'll find this is not going to work. VB does a fair amount of
> pre-compiling before calling the external compiler, and there's no way to
> intercept what's happening inside vb6.exe during the compile process.

> If you want to control the conditional-compile args on a per-build basis,
> there are build tools with that functionality built in. (All they do is
> create a temp VBP file, set the args correctly in that file, then pass
file
> that to vb6.exe to build the binary.)

> If you want to have different settings for your conditional compile args
> that vary between design-time and compile-time, then an add-in called
> vbAdvance will do that for you, as well as quite a few other "impossible"
> things in VB.
> www.vbadvance.com

> -Pete



Tue, 14 Sep 2004 03:36:17 GMT  
 Linking to library as opposed to DLL?

Quote:
> Is it possible to static link to an external library or object file with
> VB5 or is the use of DLL the only way to refer to foreign procedures?
> I'd like to call a Fortran computational module but would rather
> distribute a single executable file if possible.

A program I market called TweakVB is specifically designed for just such
tasks, though I haven't worked with Fortran. However, if the fortran
compiler can generate a standard OBJ file, it should work just fine.

Check out www.tweakvb.com



Thu, 16 Sep 2004 14:15:47 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. How to link libraries (DLLs) to an EXE?

2. DLL : Dynamically Linked Libraries

3. dll - library: mdt2dbns.dll

4. linking object libraries

5. create a dynamic linking library using visual baisc 6.0

6. auomating linking object libraries

7. linking object libraries

8. Word Link Library

9. Linking a .LIB object library to VB

10. Link with static C/C++ libraries?

11. link to static library using vb (*.lib file)

12. Problem: VBDOS and C Functions, Quick libraries, Linking

 

 
Powered by phpBB® Forum Software