a few questions HELP NEED

Everything else that doesn't fall into one of the other PB categories.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Im new at PB and i have some questions, maybe you can help me

,-------------------------------------------------------------------------------

1.- I NEED TO CALL SOME EXTERNAL DLL (not WINAPI)

i can only get to this point:

modulehandle = LoadLibrary_("test.dll")

*ret = GetProcAddress_( modulehandle, "WAV_initializeWork" )

I have the address of the function, how can i call it, i try
call *ret
but nothing.
The dll documentation says:

A sample:

typedef MERET (*me_init)(void); // prototype declaration
static me_init initfunc; // definition of an initilizing function

initfunc = ( me_init )GetProcAddress( hModule, "WAV_initializeWork" );
if( initfunc == NULL ){
// If you fail to get export
printf( "fail to get the function in gogo.dll\n" );
exit( -1 );
}else{
// If you succeed in getting export
initfunc(); // run initfunc ( WAV_initializeWork )
}

;

then i need to call the dll functions, something like:

static const char *filename = "test.wav";

WAV_setConfigure( MC_INPUTFILE, MC_INPDEV_FILE, (UPARAM)filename)

;and

UPARAM totalFrame, curFrame;
WAV_getConfigure( MG_COUNT_FRAME, (UPARAM*)&totalFrame);

; and

WAV_processFrame();

etc,etc...

How can i do it? If i try to call this dll function from PB i get an error... or maybe im doing something wrong

,-----------------------------------------------------------------------------


2.- MEMORYBANK

I get the point (i hope) but i cant find how to use it (i dont try yet)
I want something like POINTER, and i dont know if MemoryBank is the appropiate,
however i want to know any example of the use of MemoryBank (i look at the example in the ehlp file, but its not usefull and i loose the concept).

Im looking for some kind of pointer, i want to be able to call a function (procedure) by its address.
In Rapid-Q its named BIND and its something like BIND some function to its address and the just call the address and you get the procedure working

x = input
CALL x

Its used in Rapid-Q to avoid the SelectCase when you have a lot of keywords

,-----------------------------------------------------------------------------

Thanks

Ricardo Arias
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Hello:


1- to use the 'Call' funtion, have you enabled the inline assembly (compilation options), as call is an ASM function and not a PB function.
Before calling your function you have tu 'PUSH' the arguents for the function to the stack in a reverse order.

example :
for the function WAV_setConfigure( MC_INPUTFILE, MC_INPDEV_FILE, (UPARAM)filename), it looks like this in PB.

a$="test.wav"
Push Dword @a$ ; the address of the string
Push Dword MC_INPDEV_FILE
Push Dword MC_INPUTFILE
Call (the address of the api function)

2- Tonight i wrote a test library to do this, try it and tell me if it could help you.
here is the thread address :


viewtopic.php?t=142">http://forums.pure ... .php?t=142 Requests and Wishlists

hope it can help you...

Mr Skunk

Mr Skunk's PureBasic Web Page
<a href="http://www.skunknet.fr.st[/url]

Edited by - mr.skunk on 06 September 2001 01:26:03
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Hi,

Thanks i will test it tonight !!

I visit your web page and its excellent, only one suggestion: add some chapters to the tutorial with more examples and focused to the users with no asm knowledge.

Thanks

ps. your a great lib maker
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Where do you think new examples have to be added?

You know, i'm not an old ASM user, i began some month ago to write libraries for PB.
If you think some parts of the tutorial are not clear, tell me and i'll try to re-write them.

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.


First of all, i hope you try mi VISUAL IDE (just in a very early beta) : )

I read with attention your tutorial and its great, but remmember that a lot of us dont speak english as the first language (this makes more difficult the learnign process) and, in the other hand, i wish you can add more examples with different approachs to cover the diversity of needs of the different users.

I learn much from your tutorial, but some questions remainds on my head...
per example, i dont understand what is:
Segment .text USE32 CLASS=DATA
and some more things.

One more wish, zip your tutorial to gives us the opportunity to read it offline.
If you are new in ASM, my congratullations !!! you are good one.

Thanks

Ricardo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

English is not my first language too (French), but i think there's more people reading english than french so i take time to do it in english.

But it's true that a non english writer and a non english reader could have some problem to understand when using english

I tried to do a tutorial for libraries under PB, but the "Segment" function does not depend of PB but of NASM.

Do i have to write an ASM tutorial ???? NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA , but it's true i can explain some ASM things a bit better...

For the moment, feel free to ask if you have questions, it doesn't bother me at all

The Zip is a good idea, to read it offline, thanks.

I just downloaded your prog(back from hollidays) and it looks great, i have to test it...

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st

Edited by - mr.skunk on 06 September 2001 02:32:11
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
I tried to do a tutorial for libraries under PB, but the "Segment" function does not depend of PB but of NASM.

Do i have to write an ASM tutorial ???? NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
No, you dont have to do it, but since i read about it on your tutorial and i dont understand... i make the question, sorry.

Regards,

Ricardo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
For the moment, feel free to ask if you have questions, it doesn't bother me at all
Thanks !!

1.- Did you know where we can find some Nasm guide or something? not Masm because i notice thats different
2.- I put a simple example of RichEdit, how could i make it a lib?

did you receive my email?

Ricardo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Hi

1- For the Nasm guide, i only found the Nasm user guide on the nasm page, but all the assembly examples (99%) i found on the web was made for MASM/TASM. But most of the MASM sources examples (not COM or OLE ) can be easily used with NASM with minor changes (there is a special MASM to NASM mnemonic traduction dictionnary in the NASM doc)

2- To write a library the first but most important thing to do is to know what will be the PB functions (how many functions to do all the actions, the names of the functions and the number and type of arguments).

If you can tell me where is exactly your problem (the asm code? the library structure?)

You can also create functions to cut/paste... i think they didn't exists in PB.

If you need help with your library there's no problem.


No sorry, i didn't received your mail...

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Hi

1- For the Nasm guide, i only found the Nasm user guide on the nasm page, but all the assembly examples (99%) i found on the web was made for MASM/TASM. But most of the MASM sources examples (not COM or OLE ) can be easily used with NASM with minor changes (there is a special MASM to NASM mnemonic traduction dictionnary in the NASM doc)

2- To write a library the first but most important thing to do is to know what will be the PB functions (how many functions to do all the actions, the names of the functions and the number and type of arguments).

If you can tell me where is exactly your problem (the asm code? the library structure?)

You can also create functions to cut/paste... i think they didn't exists in PB.

If you need help with your library there's no problem.


No sorry, i didn't received your mail...

Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
Post Reply