undefined reference

BlitzMax Forums/BlitzMax Beginners Area/undefined reference

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I've tried out now serveral version of MinGW (3.10, 3.8, 3.1) - I ever get this error while linking.
Maybe somebody else havo more luck and a solution for.
Here's the source I try to compile (is not finished yet but without compiling this there's no need to work with anymore):

SuperStrict

Import "-ladvapi32"

'API Constants
Const SERVICES_ACTIVE_DATABASE:String = "ServicesActive"
' Service Control
Const SERVICE_CONTROL_STOP:Int = $1
Const SERVICE_CONTROL_PAUSE:Int = $2
' Service State - for CurrentState
Const SERVICE_STOPPED:Int = $1
Const SERVICE_START_PENDING:Int = $2
Const SERVICE_STOP_PENDING:Int = $3
Const SERVICE_RUNNING:Int = $4
Const SERVICE_CONTINUE_PENDING:Int = $5
Const SERVICE_PAUSE_PENDING:Int = $6
Const SERVICE_PAUSED:Int = $7
Const SERVICE_ACCEPT_STOP:Int = $1
Const SERVICE_ACCEPT_PAUSE_CONTINUE:Int = $2
Const SERVICE_ACCEPT_SHUTDOWN:Int = $4
'Service Control Manager object specific access types
Const STANDARD_RIGHTS_REQUIRED:Int = $F0000
Const SC_MANAGER_CONNECT:Int = $1
Const SC_MANAGER_CREATE_SERVICE:Int = $2
Const SC_MANAGER_ENUMERATE_SERVICE:Int = $4
Const SC_MANAGER_LOCK:Int = $8
Const SC_MANAGER_QUERY_LOCK_STATUS:Int = $10
Const SC_MANAGER_MODIFY_BOOT_CONFIG:Int = $20
Const SC_MANAGER_ALL_ACCESS:Int = $F003F 'STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK or SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG
'Service object specific access types
Const SERVICE_QUERY_CONFIG:Int = $1
Const SERVICE_CHANGE_CONFIG:Int = $2
Const SERVICE_QUERY_STATUS:Int = $4
Const SERVICE_ENUMERATE_DEPENDENTS:Int = $8
Const SERVICE_START:Int = $10
Const SERVICE_STOP:Int = $20
Const SERVICE_PAUSE_CONTINUE:Int = $40
Const SERVICE_INTERROGATE:Int = $80
Const SERVICE_USER_DEFINED_CONTROL:Int = $100
Const SERVICE_ALL_ACCESS:Int = $1FF 'STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL
' Service Install - Types
Const SERVICE_WIN32_OWN_PROCESS:Int = $10
Const SERVICE_ERROR_NORMAL:Int = $1
Const SERVICE_AUTO_START:Int = $2
Const SERVICE_DEMAND_START:Int = $3
' Service Types
Const SERVICE_WIN32_SHARE_PROCESS:Int = $20
Const SERVICE_WIN32:Int = $30

Type SERVICE_STATUS
Field dwServiceType:Int
Field dwCurrentState:Int
Field dwControlsAccepted:Int
Field dwWin32ExitCode:Int
Field dwServiceSpecificExitCode:Int
Field dwCheckPoint:Int
Field dwWaitHint:Int
End Type

Type SERVICE_TABLE_ENTRY
Field lpServiceName:String
Field lpServiceProc:Int
End Type

Extern "Win32"
Function CloseServiceHandle:Int (hSCObject:Int) = "CloseServiceHandle@4"
Function ControlService:Int (hService:Int, dwControl:Int, lpServiceStatus:Byte ptr) = "ControlService@12"
Function OpenSCManager:Int (lpMachineName:Byte Ptr, lpDatabaseName:Byte Ptr, dwDesiredAccess:Int) = "OpenSCManagerA@12"
Function OpenService:Int (hSCManager:Int, lpServiceName:Byte Ptr, dwDesiredAccess:Int) = "OpenServiceA@12"
Function QueryServiceStatus (hService:Int, lpServiceStatus:Byte ptr) = "QueryServiceStatus@8"
Function StartService:Int (hService:Int, dwNumServiceArgs:Int, lpServiceArgVectors:Int) = "StartServiceA@12"
Function CreateService:Int (hSCManager:Int, lpServiceName:Byte ptr, lpDisplayName:Byte ptr, dwDesiredAccess:Int, dwServiceType:Int, dwStartType:Int, dwErrorControl:Int, lpBinaryPathName:Byte ptr, lpLoadOrderGroup:Byte ptr, lpdwTagID:Int, lpDependencies:Byte ptr, lp:Byte ptr, lpPassword:Byte ptr) = "CreateServiceA@52"
Function StartServiceCtrlDispatcher:Int (lpServiceStartTable:Byte ptr) = "StartServiceCtrlDispatcherA@4"
Function RegisterSeviceCtrlHandler:Int(lpServiceName:Byte ptr, lpHandlerProc:Byte ptr) = "RegisterSeviceCtrlHandlerA@8"
End Extern

Function ServiceCreate:Int(ServiceName:String)
Local hSManager:Int = OpenSCManager(Null, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS)
Local res:Int
If hSManager <> 0
Local schService:Int = CreateService(hSManager, ServiceName, ServiceName, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, AppFile, Null, Null, Null, Null, Null)
DebugLog(schService)
If schService <> 0
CloseServiceHandle schService
Endif
CloseServiceHandle hSManager
EndIf
Return res
End Function

ServiceCreate "TestService"
Local svc:SERVICE_TABLE_ENTRY New SERVICE_TABLE_ENTRY
svc.lpServiceName = "MyProc"
svc.lpServiceProc = SvcMain()

Function SvcMain (argc:Int = Null, argv:String = "")
Local svcStatus:SERVICE_STATUS = New SERVICE_STATUS
svcStatus.dwServiceType = SERVICE_WIN32
svcstatus.dwCurrentState = SERVICE_START_PENDING
svcstatus.dwControlsAccepted = $7
svcstatus.dwServiceSpecificExitCode = 0
svcstatus.dwCheckPoint = 0
svcstatus.dwWin32ExitCode = 0
svcstatus.dwWaitHint = 0
Local svchandle:Int = RegisterSeviceCtrlHandler("TestService", svcCtrlHandler)
DebugLog("svchandle: " + svchandle)
End Function

Function svcCtrlHandler(dwOpcode:Int = Null)

End Function