DLL in PureBasic

Just starting out? Need help? Post your questions and find answers here.
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 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
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 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.
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 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
Post Reply