Page 1 of 1

Posted: Tue Jul 30, 2002 5:19 pm
by BackupUser
Restored from previous forum. Originally posted by Serge Lavigne.

Hi everybody

Is it possible to write a DLL in PureBasic

If so I would like to see a simple one in source code

TIA

Serge



jondo

Posted: Tue Jul 30, 2002 5:27 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

Hi,

Yes it is possible, and very simple.

Just write a procedure like this:

Code: Select all

 
ProcedureDLL Whatever(agrument1.l, argumen2.l)
  ; do whatever
EndProcedure
Now set Executable format (under compiler Options in the Editor) to 'Shared DLL'
After compilation, you'll have a file called 'purebasic.dll' in the PBcompiler-Directory, that's all.

A problem is that the compiler adds a '_' to the procedure's name.
So when calling your DLL, it should look like _Whatever .

That's it, hope it helps...

Timo

--

A debugged program is one for which you have not yet found the conditions that make it fail.

Posted: Wed Jul 31, 2002 12:03 am
by BackupUser
Restored from previous forum. Originally posted by Serge Lavigne.
Hi,

Yes it is possible, and very simple.

Just write a procedure like this:

Code: Select all

 
ProcedureDLL Whatever(agrument1.l, argumen2.l)
  ; do whatever
EndProcedure
Now set Executable format (under compiler Options in the Editor) to 'Shared DLL'
After compilation, you'll have a file called 'purebasic.dll' in the PBcompiler-Directory, that's all.

A problem is that the compiler adds a '_' to the procedure's name.
So when calling your DLL, it should look like _Whatever .

That's it, hope it helps...

Timo

--

A debugged program is one for which you have not yet found the conditions that make it fail.

Many thanks for your clear explanation

Serge

jondo