May 04, 2024, 06:11:41 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


DLL in memory

Started by zaphod, December 25, 2009, 02:44:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zaphod

Hello all, and merry christmas from France !

My problem : i want to include a dll into my program and use dll functions.
I think of include dll in resource rcdata but after...

Second question : is it possible to use obj files (like minilzo.obj) ?

thanx for any help...

Copex

-
I really should learn how to use a spell checker! though im not sure how it will help someone who can not spell?
-
Except where otherwise noted, content Posted By Copex is
licensed under a Creative Commons Attribution 3.0 License

http://creativecommons.org/licenses/by/3.0/

zaphod

Thanx Copex for help.

Not easy but it works.
I look if its possible with obj files.

Thanx again.

sapero

Zaphod, loading a .obj file is not so easy as loading dll from memory, because .obj file may import symbols not exported from dll's, and there is no info from which module a symbol is imported. Really, you'll need a mini-linker to load object files, and a function names table.
If you wish to use only data stored in object files, then this will be no problem. But to call code from .obj files when if the object file is importing symbols, then I think, the easiest way to "link" it would be using dbghelp.dll to translate function names to function addresses or offsets.

zaphod

Sapero, thanx for explanation.
Too difficult for me.

I give an example of use obj files in purebasic :


ImportC "minilzo.obj"
lzo1x_1_compress(*Source.l, SourceLength.l, *Dest.l, DestLength.l,*WorkMem.l)
lzo1x_decompress(*Source.l, SourceLength.l, *Dest.l, DestLength.l, *WorkMem.l)
lzo1x_decompress_safe(*Source.l, SourceLength.l, *Dest.l, DestLength.l,*WorkMem.l)
lzo_adler32(Adler.l, *Buf.l, Len.l)
;
lzo_version()
lzo_version_string()
lzo_version_date()
EndImport


sapero

In ebasic just replace ImportC with $use, or add your .obj file to project. An obj file has the same format as .o file.