Create - Very Simple DLL

Category: DLLs

Date: 02-16-2022

Return to Index


 
'This snippet is 4 of 4 covering DLL creation, in this case a very simple DLL.
'It demonstrates exporting a single Function AND does Not use LibMain.
 
'Check out the background information On DLLs at http://gbl_00320
 
'Primary Code:
'This very simple example has only one Function, which is EXPORTed.
'The #Compile DLL compiler directive is the key statement. This tells
'the compiler to create a DLL (rather than an EXE).
#Compile DLL
Function FlipCoin ALIAS "FlipCoin" (uLimit&) EXPORT As Long
   Function = Rnd(0,uLimit&)
End Function
 
 
'Compilable Example:  (Jose Includes)
'This is all there is - just a compiler directive to Create the DLL AND
'a short Function which is exported for applications to use. The resulting
'DLL carries the name of the .BAS file. You can manually change the DLL
'name once the compile is complete.
#Compiler PBWin 9, PBWin 10
#Compile DLL
 
Function FlipCoin ALIAS "FlipCoin" (uLimit&) EXPORT As Long
   Function = Rnd(0,uLimit&)
End Function
 
'gbs_00173
'Date: 03-10-2012


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm