You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
I’m really new to both Powerbasic and DLLs So what I need is to make a DLL that I can use in both Visual Basic 2008 and Powerbasic 9
What I’ve done so far is to use the standard DLL framework in PB9 Added a skeleton for my program and compiled it to a DLL.
In VB9 when I tried to run it says "A first chance exception of type 'System.EntryPointNotFoundException' occurred in testDll.exe"
powerbasic code as follows ------------------------------------------------------------------
#COMPILE DLL #DIM ALL %USEMACROS = 1 #INCLUDE "Win32API.inc" GLOBAL ghInstance AS DWORD '------------------------------------------------------------------------------- ' Main DLL entry point called by Windows... ' FUNCTION LIBMAIN (BYVAL hInstance AS LONG, _ BYVAL fwdReason AS LONG, _ BYVAL lpvReserved AS LONG) AS LONG SELECT CASE fwdReason CASE %DLL_PROCESS_ATTACH 'Indicates that the DLL is being loaded by another process (a DLL 'or EXE is loading the DLL). DLLs can use this opportunity to 'initialize any instance or global data, such as arrays. ghInstance = hInstance FUNCTION = 1 'success! 'FUNCTION = 0 'failure! This will prevent the EXE from running. CASE %DLL_PROCESS_DETACH 'Indicates that the DLL is being unloaded or detached from the 'calling application. DLLs can take this opportunity to clean 'up all resources for all threads attached and known to the DLL. FUNCTION = 1 'success! 'FUNCTION = 0 'failure! CASE %DLL_THREAD_ATTACH 'Indicates that the DLL is being loaded by a new thread in the 'calling application. DLLs can use this opportunity to 'initialize any thread local storage (TLS). FUNCTION = 1 'success! 'FUNCTION = 0 'failure! CASE %DLL_THREAD_DETACH 'Indicates that the thread is exiting cleanly. If the DLL has 'allocated any thread local storage, it should be released. FUNCTION = 1 'success! 'FUNCTION = 0 'failure! END SELECT END FUNCTION FUNCTION CalculatePrice(Designation AS STRING, Amount AS INTEGER, Discount AS DOUBLE) EXPORT AS STRING
SELECT CASE LEFT$(Designation,1) CASE "H", "F", "P", "R", "T", "Z", "C" CalculatePrice = Designation CASE "M", "K" CASE "L" CASE "W" CASE "B" CASE "A", "S", "D" END SELECT
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: