Page 1 of 1
Objective-C method not found by pb
Posted: Sun Aug 03, 2025 7:18 am
by devulder
Hi All,
I try to create with Xcode a dynamic library (objective-c .mm file) for use with pb.
extern "C" {
void openRequester(void);
}
void
openRequester(void)
{
}
Compilation are ok,
When i use ImportC, loading lib are OK but
pb fails always for find correct method signature for method "openRequester"
Anybody know in github or other a simple example for where is the problem
Thanks,
Re: Objective-C method not found by pb
Posted: Sun Aug 03, 2025 6:26 pm
by mk-soft
I created a library with Xcode for the first time today and it worked.
But I don't know what you have to set to create the "xyz.lib" for ImportC and I could use some help.
So I opened my own lib with OpenLibrary
I watched a simple example on YouTube
New project created for library
- Framework = none
- Dynamic
Project Context
- New from Template -> C++ File include header
libMyLib.hpp
Code: Select all
//
// libMyLib.hpp
// MyLib
//
// Created by Michael on 03.08.25.
//
#ifndef libMyLib_hpp
#define libMyLib_hpp
#include <stdio.h>
extern "C" {
int min(int x, int y);
int max(int x, int y);
}
#endif /* libMyLib_hpp */
libMyLib.cpp
Code: Select all
//
// libMyLib.cpp
// MyLib
//
// Created by Michael on 03.08.25.
//
#include "libMyLib.hpp"
int min(int x, int y) {
return x < y ? x : y;
}
int max(int x, int y) {
return x > y ? x : y;
}
PureBasic TextCode
Code: Select all
PrototypeC min(x,y)
PrototypeC max(x,y)
If OpenLibrary(0, "libMyLib.dylib")
min.min = GetFunction(0, "min")
max.max = GetFunction(0, "max")
Else
Debug "no lib"
End
EndIf
a = 10
b = 20
c = min(a, b)
Debug c
c = max(a, b)
Debug c
Re: Objective-C method not found by pb
Posted: Sun Aug 03, 2025 7:02 pm
by devulder
Hi,
Thanks, i look this