Below are 3 simple programs. The first "one.c" uses the function to translate a sample path works fine.
- Code: Select all
/*
gcc -o one one.c
This works
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <amiga_platform.h>
#include <exec/types.h>
#include <proto/dos.h>
#include <proto/exec.h>
int main() {
struct NameTranslationInfo nti;
const char* path = "sdk:newlib";
printf("Path= %s\n",path);
__translate_amiga_to_unix_path_name(&path,&nti);
printf("Path= %s\n",path);
/*
char* buf = (char*)malloc(PATH_MAX);
BPTR lck = IDOS->GetProgramDir();
if (lck != ZERO) {
if (IDOS->NameFromLock(lck, buf, PATH_MAX)){
printf("dir=%s\n",buf);
}
}
free(buf);
*/
return 0;
}
The second "two.c" uses IDOS functions to get the program directory works fine.
- Code: Select all
/*
gcc -o two two.c
This works
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <amiga_platform.h>
#include <exec/types.h>
#include <proto/dos.h>
#include <proto/exec.h>
int main() {
/*
struct NameTranslationInfo nti;
const char* path = "sdk:newlib";
printf("Path= %s\n",path);
__translate_amiga_to_unix_path_name(&path,&nti);
printf("Path= %s\n",path);
*/
char* buf = (char*)malloc(PATH_MAX);
BPTR lck = IDOS->GetProgramDir();
if (lck != ZERO) {
if (IDOS->NameFromLock(lck, buf, PATH_MAX)){
printf("dir=%s\n",buf);
}
}
free(buf);
return 0;
}
The third "three.c" attempts top combine both these operations into one simple executable but it crashes @IDOS->GetProgramDir and I can for life of me determine why.
- Code: Select all
/*
gcc -o three three.c
This crashes on call to IDOS->GetProgramDir()
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <amiga_platform.h>
#include <exec/types.h>
#include <proto/dos.h>
#include <proto/exec.h>
int main() {
struct NameTranslationInfo nti;
const char* path = "sdk:newlib";
printf("Path= %s\n",path);
__translate_amiga_to_unix_path_name(&path,&nti);
printf("Path= %s\n",path);
char* buf = (char*)malloc(PATH_MAX);
BPTR lck = IDOS->GetProgramDir();
if (lck != ZERO) {
if (IDOS->NameFromLock(lck, buf, PATH_MAX)){
printf("dir=%s\n",buf);
}
}
free(buf);
return 0;
}
Any assistance would be appreciated as I am trying to builds some tools that interface with the gcc 5.4 but binutils in that build no longer works correctly with non unix semantics. That issue is outside scope of this help request but as interest to what I a messing with this function as I dont want to spin my own

This has been baffling me for week to understand whats up but it only happens if I actually reference the function call __translate_amiga_to_unix_path_name
Regards
Doug